Copula functions in R(译文)

Rplot.png

](http://upload-images.jianshu.io/upload_images/1146658-83479178c58db980.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

此处的I是[0,1].

阿基米德copula是一种特殊的copula,他可以用如下copula生成函数(也就是phi函数)构建,定义如下:

本文中,我们会通过R看到阿基米德copula中的主要元素:Gumbel copula.它是由下面的生成函数创建的:

还会运用到如下表达式:

R的相关package名字就叫Gumbel,可通过如下命令安装:

library(gumbel)

加载了该package之后,就可以使用一些基本功能了,比如下列密度函数:

x <- seq(0.01,0.99,length=50)
y <- x
z <- outer(x,y,dgumbel,alpha=2)
persp(x,y,z,theta=30,phi=30,expand=0.5,col="lightgreen",ltheta=100,xlab="x",ticktype="detailed",ylab="y",zlab="Density of the Gumbel copula")

还有累积分布函数CDF如下:

最后,我们来看一下随机数生成函数。由Gumbel copula模拟的依赖性,只取决于theta一个参数。当theta增加时,观测值之间的相关性也会增加。因此你可能注意到了,如果theta等于1(对于Gumbel copula来说就是theta在[1, Inf)),则我们实际上就回到了独立的情形.比如如下的情况:

# we simulate 2000 observations with theta = 1
r_matrix <- t(rgumbel(2000,1))
plot(r_matrix[1,],r_matrix[2,],col="blue",main="Gumbel, independence case")

如果我们增大theta到2,可以看到相关性的提高:

# we simulate 2000 observations with theta = 2
r_matrix <- t(rgumbel(2000,2))
plot(r_matrix[1,],r_matrix[2,],col="blue",main="Gumbel, independence case")

可以看到,Gumbel copula可以用来模拟正的和不对称的相关性.图中的相关性在较大数值的一端更大.我们再将theta提高到3,如下:

# we simulate 2000 observations with theta = 3
r_matrix <- t(rgumbel(2000,3))
plot(r_matrix[1,],r_matrix[2,],col="blue",main="Gumbel, independence case")

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容