fitCopula {copula} | R Documentation |
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 from true observations from the copula.
loglikCopula(param, x, copula, suppressMessages=FALSE) fitCopula(copula, data, method="mpl", start=NULL, lower=NULL, upper=NULL, optim.control = list(NULL), optim.method = "BFGS", estimate.variance = TRUE)
param |
a vector of parameter values. |
x |
a data matrix. |
data |
a data matrix. |
copula |
a "copula" object. |
suppressMessages |
logical, if TRUE, warnings messages from evaluating loglikelihood at invalid parameter values are suppressed. |
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 method is "mpl". |
start |
a vector of starting value for "param" . |
lower, upper |
bounds on the variables for the "L-BFGS-B" method. |
optim.control |
a list of controls to be passed to "optim" . |
optim.method |
the method for "optim" . |
estimate.variance |
logical, if TRUE, the large-sample variance is estimated. |
The return value of "loglikCopula"
is
the loglikelihood evaluated at the given value of "param"
.
The return values of "fitCopula"
is an object of class
"fitCopula"
ontaining slots:
estimate |
the estimate of the parameters. |
var.est |
large-sample variance estimate of the parameter estimator. |
method |
the estimation method. |
loglik |
loglikelihood at "est" . |
copula |
the fitted copula. |
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.
For the t copula with df.fixed=FALSE
(see ellipCopula
),
the methods "itau"
and "irho"
in "fitCopula"
cannot be used. The methods "ml"
and "mpl"
can be
employed provided the parameter "start"
is assigned a
value. See the example below. Also, the large-sample variance cannot be
estimated if method "mpl"
is chosen.
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 c.d.f.s and "method"
need 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
).
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 Hydrological Engineering 12, 347-368.
I. Kojadinovic and J. Yan (2008), Comparison of three semiparametric methods for estimating dependence parameters in copula models, submitted.
gumbel.cop <- gumbelCopula(3, dim=2) n <- 200 x <- rcopula(gumbel.cop, n) ## true observations u <- apply(x, 2, rank) / (n + 1) ## 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 <- apply(x, 2, rank) / (n + 1) ## 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 df.fixed=FALSE t.cop <- tCopula(c(0.2,0.4,0.6),dim=3,dispstr="un",df=5) x <- rcopula(t.cop, n) ## true observations u <- apply(x, 2, rank) / (n + 1) ## pseudo-observations ## maximum likelihood fit.ml <- fitCopula(t.cop, x, method="ml", start=c(0,0,0,10)) fit.ml ## maximum pseudo-likelihood; the asymptotic variance cannot be estimated fit.mpl <- fitCopula(t.cop, u, method="mpl", start=c(0,0,0,10), estimate.variance=FALSE) fit.mpl