fitCopula {copula}R Documentation

Estimation of the Parameters in Copula Models

Description

Fits a copula model to multivariate data belonging to the unit hypercube. The data can be pseudo-observations constructed from empirical or parametric marginal distribution functions, or true observations from the copula.

Usage

loglikCopula(param, x, copula, hideWarnings)
fitCopula(copula, data, method = c("mpl", "ml", "itau", "irho"),
          start = NULL, lower = NULL, upper = NULL,
          optim.method = "BFGS", optim.control = list(maxit=1000),
          estimate.variance = NA, hideWarnings = TRUE)

Arguments

param

a vector of parameter values.

x, data

n x d-matrix of (pseudo-)observations (for "mpl" and "ml" with values necessarily in [0,1]) from the copula to be estimated, where n denotes the sample size and d the dimension. Consider applying the function pobs() first in order to obtain values in [0,1].

copula

a "copula" object.

hideWarnings

deprecated and unused for loglikCopula(); logical; if TRUE, warning messages from likelihood maximization (mostly evaluating at invalid parameter values) are suppressed.

method

a character string specifying the method; can be either "ml" (maximum likelihood), "mpl" (maximum pseudo-likelihood), "itau" (inversion of Kendall's tau), and "irho" (inversion of Spearman's rho). The last three methods assume that the data are pseudo-observations (scaled ranks), while the first method assumes that the data are observations from the unknown copula. The default is "mpl".

start

a vector of starting values for param.

lower, upper

bounds on the variables for the "Brent" or "L-BFGS-B" method.

optim.control

a list of control parameters to be passed to optim(*, control=optim.control).

optim.method

the method for optim().

estimate.variance

logical; if true (as by default, if the optimization converges), the asymptotic variance is estimated.

Details

There are methods for vcov(), coef(), logLik(), and nobs().

Value

loglikCopula() returns the log likelihood evaluated at the given value of "param".

The return value of fitCopula() is an object of class "fitCopula" (see there), containing slots (among others!)

estimate

the estimate of the parameters.

var.est

large-sample (i.e., asymptotic) variance estimate of the parameter estimator (filled with NA if estimate.variance = FALSE).

copula

the fitted copula.

The summary() method for "fitCopula" objects returns a S3 “class” "summary.fitCopula", simply a list with components method, loglik, and convergence, all three from corresponding slots of the "fitCopula" objects, and

coefficients

a matrix of estimated coefficients, standard errors, t values and p-values.

Note

In the multiparameter elliptical case and when the estimation is based on Kendall's tau or Spearman's rho, the estimated correlation matrix may not always be positive-definite. If it is not, the correction proposed by Rousseeuw and Molenberghs (1993) is applied and a warning message given.

If method "mpl" in fitCopula() is used and if start is not assigned a value, estimates obtained from method "itau" are used as initial values in the optimization.

If methods "itau" or "itau" are used in fitCopula(), an estimate of the asymptotic variance (if available for the copula under consideration) will be correctly computed only if the argument data consists of pseudo-observations (see pobs()).

For the t copula with df.fixed=FALSE (see ellipCopula()), the methods "itau" and "irho" cannot be used in fitCopula(). For the methods "ml" and "mpl", when start is not specified, the starting value for df is set to copula@df, typically 4. Also, the asymptotic variance cannot (yet) be estimated for method "mpl".

To implement the “inference functions for margins” method (see, e.g., Joe 2005), the data need to be pseudo-observations obtained from fitted parametric marginal distribution functions and method needs to be set to "ml". The returned large-sample variance will then underestimate the true variance.

Finally, note that the fitting functions generate error messages because invalid parameter values are tried during the optimization process (see optim()). When the number of parameters is one and the parameter space is bounded, using optim.method="Brent" is likely to give less warnings. Furthermore, from experience, optim.method="Nelder-Mead" is sometimes a more robust alternative to optim.method="BFGS".

References

Genest, C. (1987). Frank's family of bivariate distributions. Biometrika 74, 549–555.

Genest, C. and Rivest, L.-P. (1993). Statistical inference procedures for bivariate Archimedean copulas. Journal of the American Statistical Association 88, 1034–1043.

Rousseeuw, P. and Molenberghs, G. (1993). Transformation of nonpositive semidefinite correlation matrices. Communications in Statistics: Theory and Methods 22, 965–984.

Genest, C., Ghoudi, K., and Rivest, L.-P. (1995). A semiparametric estimation procedure of dependence parameters in multivariate families of distributions. Biometrika 82, 543–552.

Joe, H. (2005). Asymptotic efficiency of the two-stage estimation method for copula-based models. Journal of Multivariate Analysis 94, 401–419.

Demarta, S. and McNeil, A. J. (2005). The t copula and related copulas. International Statistical Review 73, 111–129.

Genest, C. and Favre, A.-C. (2007). Everything you always wanted to know about copula modeling but were afraid to ask. Journal of Hydrologic Engineering 12, 347–368.

Kojadinovic, I. and Yan, J. (2010). Comparison of three semiparametric methods for estimating dependence parameters in copula models. Insurance: Mathematics and Economics 47, 52–63.

See Also

Copula, mvdc for fitting multivariate distributions including the margins aka “meta copula”s; gofCopula.

For maximum likelihood of (nested) archimedean copulas: emle, etc.

Examples

gumbel.cop <- gumbelCopula(3, dim=2)

(Xtras <- copula:::doExtras())
n <- if(Xtras) 200 else 64

set.seed(7) # for reproducibility
x <- rCopula(n, gumbel.cop)## "true" observations
u <- pobs(x)               ## pseudo-observations
## inverting Kendall's tau
fit.tau <- fitCopula(gumbel.cop, u, method="itau")
fit.tau
coef(fit.tau)# named vector
## inverting Spearman's rho
fit.rho <- fitCopula(gumbel.cop, u, method="irho")
fit.rho
## maximum pseudo-likelihood
fit.mpl <- fitCopula(gumbel.cop, u, method="mpl")
fit.mpl
## maximum likelihood
fit.ml <- fitCopula(gumbel.cop, x, method="ml")
fit.ml # print()ing works via summary() ...
## and of that, what's the log likelihood (in two different ways):
(ll. <- logLik(fit.ml))
stopifnot(all.equal(as.numeric(ll.),
    loglikCopula(coef(fit.ml), x=x, copula=gumbel.cop)))

## a multiparameter example
set.seed(6)
normal.cop <- normalCopula(c(0.6,0.36, 0.6),dim=3,dispstr="un")
x <- rCopula(n, normal.cop) ## "true" observations
u <- pobs(x)                ## pseudo-observations
## inverting Kendall's tau
fit.tau <- fitCopula(normal.cop, u, method="itau")
fit.tau
## inverting Spearman's rho
fit.rho <- fitCopula(normal.cop, u, method="irho")
fit.rho
## maximum pseudo-likelihood
fit.mpl <- fitCopula(normal.cop, u, method="mpl")
fit.mpl
coef(fit.mpl) # named vector
str(sf.mpl <- summary(fit.mpl))
coef(sf.mpl)# the matrix, with SE, t-value, ...

## maximum likelihood
fit.ml <- fitCopula(normal.cop, x, method="ml")
fit.ml
## with dispstr="toep"
normal.cop.toep <- normalCopula(c(0, 0), dim=3, dispstr="toep")
## inverting Kendall's tau
fit.tau <- fitCopula(normal.cop.toep, u, method="itau")
fit.tau
## inverting Spearman's rho
fit.rho <- fitCopula(normal.cop.toep, u, method="irho")
fit.rho
## maximum pseudo-likelihood
fit.mpl <- fitCopula(normal.cop.toep, u, method="mpl")
fit.mpl
## maximum likelihood
fit.ml <- fitCopula(normal.cop.toep, x, method="ml")
fit.ml
## with dispstr="ar1"
normal.cop.ar1 <- normalCopula(c(0), dim=3, dispstr="ar1")
## inverting Kendall's tau
fit.tau <- fitCopula(normal.cop.ar1, u, method="itau")
fit.tau
## inverting Spearman's rho
fit.rho <- fitCopula(normal.cop.ar1, u, method="irho")
fit.rho
## maximum pseudo-likelihood
fit.mpl <- fitCopula(normal.cop.ar1, u, method="mpl")
fit.mpl
## maximum likelihood
fit.ml <- fitCopula(normal.cop.ar1, x, method="ml")
fit.ml

## a t copula with variable df  (df.fixed=FALSE):
(tCop <- tCopula(c(0.2,0.4,0.6), dim=3, dispstr="un", df=5))
set.seed(101)
x <- rCopula(n, tCop) ## "true" observations
u <- pobs(x)          ## pseudo-observations
## maximum likelihood;   start := (rho[1:3], df)
(tc.ml  <- fitCopula(tCop, x, method="ml", start=c(0,0,0, 10)))
(tc.ml. <- fitCopula(tCop, x, method="ml")) # without 'start'
## maximum pseudo-likelihood; the asymptotic variance cannot be estimated
(tc.mpl <- fitCopula(tCop, u, method="mpl", estimate.variance=FALSE,
                     start= c(0,0,0,10)))

if(Xtras) { ##---- typically not run with CRAN checking: ---

## without start:
(tc.mp. <- fitCopula(tCop, u, method="mpl", estimate.variance=FALSE))
all.eqCop <- function(x,y, ...) {
   x@fitting.stats$counts <- y@fitting.stats$counts <- NULL
   all.equal(x,y, ...) }
stopifnot(all.eqCop(tc.ml , tc.ml., tolerance= .005),
          all.eqCop(tc.mpl, tc.mp., tolerance= .005))

## same t copula but with df.fixed=TRUE	 (--> use same data!)
(tC.f <- tCopula(c(0.2,0.4,0.6), dim=3, dispstr="un", df=5, df.fixed=TRUE))
## maximum likelihood;  start := rho[1:3]		    -------------
(tcF.ml  <- fitCopula(tC.f, x, method="ml", start=c(0,0,0)))
(tcF.ml. <- fitCopula(tC.f, x, method="ml"))# without 'start'
stopifnot(all.eqCop(tcF.ml,tcF.ml., tolerance= 4e-4))
## the (estimated, asymptotic) var-cov matrix:
vcov(tcF.ml)

## maximum pseudo-likelihood; the asymptotic variance cannot be estimated
(tcF.mpl <- fitCopula(tC.f, u, method="mpl", estimate.variance=FALSE,
                      start=c(0,0,0)))
(tcF.mp. <- fitCopula(tC.f, u, method="mpl", estimate.variance=FALSE))
stopifnot(all.eqCop(tcF.mpl,tcF.mp., tolerance= 1e-5))

}## end{typically not run ...}


[Package copula version 0.999-14 Index]