问题:以下可重现示例会产生错误:
optim中的错误(start,loglikCopula,lower = lower,upper = upper, method = method,''vmmin'中的初始值不是有限的
我无法找到如何克服这个问题。
要重现我的数据集(只需复制粘贴并运行以下代码:)
#REPRODUCABLE DATA SET
###############################################
library(MASS)
library(stats)
sim.cop<- plackettCopula(param = 10)
set.seed(1)
u<-rCopula(n = 800,copula = sim.cop)
V1<-qt(p = u[,col=1],df = 3.5)
V1<-0.013*V1+0.0004
V2<-qt(p = u[,col=2],df = 3.5)
V2<-0.013*V2+0.0004
m1<-fitdistr(x = V1,densfun = "normal")
m2<-fitdistr(x = V2,densfun = "normal")
V1.u<- pnorm(q = V1,mean = m1$estimate["mean"] ,sd = m1$estimate["sd"])
V2.u<- pnorm(q = V2,mean = m2$estimate["mean"] ,sd = m2$estimate["sd"])
data.u<-cbind(V1.u,V2.u)
产生错误的命令
#fit copula
###############################################
library(copula)
cop<-normalCopula(param = 0.5,dim = 2)
fitting<-fitCopula(copula = cop,data = data.u,method = "ml")