Helpful Stan Functions
Clayton Copula Functions

Functions

real clayton_copula_lpdf (real u, real v, real theta)
 

Detailed Description

The Clayton copula bivariate cumulative density function is defined as

\[ C(u,v) = (u^{-\theta} + v^{-\theta} - 1)^{-1/\theta} \]

for \(0 < \theta < \infty\).

The Clayton copula bivariate probability density function is defined as

\[ c(u, v) = \frac{ \partial^2 C(u, v) }{ \partial u \partial v} = (\theta + 1)(uv)^{-(\theta + 1)}(u^{-\theta} + v^{-\theta} - 1)^{-\frac{2 \theta + 1}{\theta}} \]

real clayton_copula_lpdf(real u, real v, real theta) {
if (theta <= 0.0)
reject("clayton_copula: theta must > 0");
return log1p(theta) - (theta + 1) * (log(u) + log(v))
- (1 + 2 * theta) / theta * log(pow(u, -theta) + pow(v, -theta) - 1);
}
real clayton_copula_lpdf(real u, real v, real theta)
Definition: clayton_copula.stanfunctions:37

Function Documentation

◆ clayton_copula_lpdf()

real clayton_copula_lpdf ( real  u,
real  v,
real  theta 
)

Clayton Bivariate Copula Log Density

Stan Example: clayton_copula_example.stan
R: clayton_example.R

Copyright Andre Pfeuffer, Sean Pinkney
https://groups.google.com/g/stan-users/c/hnUtkMYlLhQ/m/XdX3u1vDAAAJ
Accessed and modified Feb. 5, 2021

The copula is defined \(0 < \theta < \infty\)

Parameters
uReal number on \((0,1]\), not checked but function will return NaN
vReal number on \((0,1]\), not checked but function will return NaN
thetaReal number on (0, Inf)
Returns
log density
Exceptions
rejectif theta \(\le 0\)