Charles Thuo
2014-Mar-07 07:41 UTC
[R] fitting the lognormal and negative binomial into a gumble copula
# I define a bivariate copula composed of 2 marginals each with 2 parameters
gmb<-gumbelCopula(4,dim=2)
# Idefine the bivariate CDF specifying the already fitted parameters
from the log normal and negative binomial
myCDF<-mvdc(gmb,margins=c("lnorm","nbinom"),paramMargins=list(list(meanlog=11.69,sdlog=0.7781),list(mu=16,prob=0.257)))
# Instead of supplying the risk data i try to simulate and get an error.
How can i resolve the error.
x <- rMvdc(myCDF,1000)
Error in rMvdc(myCDF, 1000) :
trying to get slot "copula" from an object of a basic class
("numeric")
with no slots
# I also try to simulate the risk data as a matrix
y<- cbind(rlnorm(1000,11.69,0.7781),rnbinom(1000,mu=16,size=2.6))
#I attempt to fit the parameters of the copula starting with the parameters
meanlog=12,sdlog=2 for the log normal and mu=16, prob=0.3 for the negative
binomial. I get an error how can i resolve this
Fitted<-fitMvdc(y, myCDF, c(3,9,1,1))
Error in fitMvdc(y, myCDF, c(3, 9, 1, 1)) :
The lengths of 'start' and mvdc parameters do not match.
With Kind Regards,
Charles
Chief Risk Officer Directline Assurance Co. Ltd(Kenya)
[[alternative HTML version deleted]]