gumbel.cop <- gumbelCopula(3, dim=2)
gMvd2 <- mvdc(gumbel.cop, c("exp","exp"),
list(list(rate=2), list(rate=4)))
set.seed(11)
x <- rMvdc(10000, gMvd2)
## with identical margins:
gMvd.I <- mvdc(gumbel.cop, "exp", param = list(rate=3), marginsIdentical=TRUE)
if(copula:::doExtras()) { ## these are typically not run with CRAN checking:
## Takes about 25 sec. [2012-07]:
fit2 <- fitMvdc(x, gMvd2, start = c(1,1, 2),
hideWarnings=FALSE) ## <- show warnings here
print(fit2)
## The (estimated, asymptotic) var-cov matrix:
print( vcov(fit2) )
fitI <- fitMvdc(x, gMvd.I, start = c(3, 2),
optim.control=list(trace= TRUE, REPORT= 2))
print(coef(summary(fitI)))
print(fitI)
## a wrong starting value can already be *the* problem:
f2 <- try(fitMvdc(x, gMvd.I, start = c(1, 1),
optim.control=list(trace= TRUE, REPORT= 2)))
##--> Error in optim( ... ) : non-finite finite-difference value [2]
##==> "Solution" : Using a more robust (but slower) optim() method:
fI.2 <- fitMvdc(x, gMvd.I, start = c(1, 1), method = "Nelder",
optim.control=list(trace= TRUE))
## The (estimated, asymptotic) var-cov matrix:
print( vcov(fit2) )
str(sfI <- summary(fitI))
stopifnot(is.matrix(coef(sfI)))
}
Run the code above in your browser using DataLab