在R中拟合copula模型

时间:2019-05-11 20:18:40

标签: r statistics

我想完成创建最佳股票投资组合的任务,并使用kopulas对它们之间的收益进行建模。

我有数据:4只股票的回报:

s1 <- read.csv('s1.csv',header=F)$V2
s2 <- read.csv('s2.csv',header=F)$V2
s3 <- read.csv('s3.csv',header=F)$V2
s4 <- read.csv('s4.csv',header=F)$V2

然后我尝试拟合t-copula并绘制密度

t.cop <- tCopula(dim=4)
set.seed(500)
m <- pobs(as.matrix(cbind(s1,s2,s3,s4)))
fit <- fitCopula(t.cop,m,method='ml')
coef(fit)
rho <- coef(fit)[1]
df <- coef(fit)[2]
persp(tCopula(dim=2,rho,df=df),dCopula)

但是我不明白如何建造其他类型的copulas(例如葡萄copulas)。我如何找到最佳投资组合?

0 个答案:

没有答案