Learn R Programming

copula (version 0.99-4)

fitCopula: 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 c.d.f.s, or true observations from the copula.

Usage

loglikCopula(param, x, copula, hideWarnings = FALSE)
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 = TRUE, hideWarnings = TRUE)

Arguments

param
a vector of parameter values.
x, data
numeric data matrix.
copula
a "copula" object.
hideWarnings
logical; if TRUE, warning messages from evaluating the loglikelihood 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)
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, the asymptotic variance is estimated.

Value

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

    The return value of fitCopula() is an object of class "fitCopula" containing slots (among others):

  • estimatethe estimate of the parameters.
  • var.estestimate of the asymptotic variance estimate of the parameter estimator.
  • methodthe estimation method.
  • loglikloglikelihood at "estimate".
  • copulathe fitted copula.

References

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

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

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

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

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

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

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

I. Kojadinovic and J. Yan (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 copulas; gofCopula.

Examples

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

n <- 200
x <- rcopula(gumbel.cop, n)## "true" observations
u <- pobs(x)               ## pseudo-observations
## inverting Kendall's tau
fit.tau <- fitCopula(gumbel.cop, u, method="itau")
fit.tau
## 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

## a multiparameter example
normal.cop <- normalCopula(c(0.6,0.36, 0.6),dim=3,dispstr="un")
x <- rcopula(normal.cop, n) ## "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
## 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(tCop, n) ## "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)))
## without start:
(tc.mp. <- fitCopula(tCop, u, method="mpl", estimate.variance=FALSE))
stopifnot(all.equal(tc.ml , tc.ml., tol= .005),
          all.equal(tc.mpl, tc.mp., tol= .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.equal(tcF.ml,tcF.ml., tol= 4e-4))

## 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.equal(tcF.mpl,tcF.mp., tol= 1e-5))

Run the code above in your browser using DataLab