emle: Maximum Likelihood Estimators for (Nested) Archimedean...

View source: R/estimation.R

emleR Documentation

Maximum Likelihood Estimators for (Nested) Archimedean Copulas

Description

Compute (simulated) maximum likelihood estimators for (nested) Archimedean copulas.

Usage

emle(u, cop, n.MC=0, optimizer="optimize", method,
     interval=initOpt(cop@copula@name),
     start=list(theta=initOpt(cop@copula@name, interval=FALSE, u=u)),
     ...)
.emle(u, cop, n.MC=0,
      interval=initOpt(cop@copula@name), ...)

Arguments

u

n\times d-matrix of (pseudo-)observations (each value in [0,1]) from the copula, with n the sample size and d the dimension.

cop

outer_nacopula to be estimated (currently only non-nested, that is, Archimedean copulas are admitted).

n.MC

integer, if positive, simulated maximum likelihood estimation (SMLE) is used with sample size equal to n.MC; otherwise (n.MC=0), MLE. In SMLE, the dth generator derivative and thus the copula density is evaluated via (Monte Carlo) simulation, whereas MLE uses the explicit formulas for the generator derivatives; see the details below.

optimizer

a string or NULL, indicating the optimizer to be used, where NULL means to use optim via the standard R function mle() from (base R) package stats4, whereas the default, "optimize" uses optimize via the R function mle2() from package bbmle.

method

only when optimizer is NULL or "optim", the method to be used for optim.

interval

bivariate vector denoting the interval where optimization takes place. The default is computed as described in Hofert et al. (2012).

start

list of initial values, passed through.

...

additional parameters passed to optimize.

Details

Exact formulas for the generator derivatives were derived in Hofert et al. (2012). Based on these formulas one can compute the (log-)densities of the Archimedean copulas. Note that for some densities, the formulas are numerically highly non-trivial to compute and considerable efforts were put in to make the computations numerically feasible even in large dimensions (see the source code of the Gumbel copula, for example). Both MLE and SMLE showed good performance in the simulation study conducted by Hofert et al. (2013) including the challenging 100-dimensional case. Alternative estimators (see also enacopula) often used because of their numerical feasibility, might break down in much smaller dimensions.

Note: SMLE for Clayton currently faces serious numerical issues and is due to further research. This is only interesting from a theoretical point of view, since the exact derivatives are known and numerically non-critical to evaluate.

Value

emle

an R object of class "mle2" (and thus useful for obtaining confidence intervals) with the (simulated) maximum likelihood estimator.

.emle

list as returned by optimize() including the maximum likelihood estimator (does not confidence intervals but is typically faster).

References

Hofert, M., Mächler, M., and McNeil, A. J. (2012). Likelihood inference for Archimedean copulas in high dimensions under known margins. Journal of Multivariate Analysis 110, 133–150.

Hofert, M., Mächler, M., and McNeil, A. J. (2013). Archimedean Copulas in High Dimensions: Estimators and Numerical Challenges Motivated by Financial Applications. Journal de la Société Française de Statistique 154(1), 25–63.

See Also

mle2 from package bbmle and mle from stats4 on which mle2 is modeled. enacopula (wrapper for different estimators). demo(opC-demo) and demo(GIG-demo) for examples of two-parameter families.

Examples

tau <- 0.25
(theta <- copGumbel@iTau(tau)) # 4/3
d <-  20
(cop <- onacopulaL("Gumbel", list(theta,1:d)))

set.seed(1)
n <- 200
U <- rnacopula(n,cop)

## Estimation
system.time(efm <- emle(U, cop))
summary(efm) # using bblme's 'mle2' method

## Profile likelihood plot [using S4 methods from bbmle/stats4] :
pfm <- profile(efm)
ci  <- confint(pfm, level=0.95)
ci
stopifnot(ci[1] <= theta, theta <= ci[2])
plot(pfm)               # |z| against theta, |z| = sqrt(deviance)
plot(pfm, absVal=FALSE, #  z  against theta
     show.points=TRUE) # showing how it's interpolated
## and show the true theta:
abline(v=theta, col="lightgray", lwd=2, lty=2)
axis(1, pos = 0, at=theta, label=quote(theta[0]))

## Plot of the log-likelihood, MLE  and  conf.int.:
logL <- function(x) -efm@minuslogl(x)
       # == -sum(copGumbel@dacopula(U, theta=x, log=TRUE))
logL. <- Vectorize(logL)
I <- c(cop@copula@iTau(0.1), cop@copula@iTau(0.4))
curve(logL., from=I[1], to=I[2], xlab=quote(theta),
      ylab="log-likelihood",
      main="log-likelihood for Gumbel")
abline(v = c(theta, efm@coef), col="magenta", lwd=2, lty=2)
axis(1, at=c(theta, efm@coef), padj = c(-0.5, -0.8), hadj = -0.2,
     col.axis="magenta", label= expression(theta[0], hat(theta)[n]))
abline(v=ci, col="gray30", lwd=2, lty=3)
text(ci[2], extendrange(par("usr")[3:4], f= -.04)[1],
     "95% conf. int.", col="gray30", adj = -0.1)

copula documentation built on Sept. 11, 2024, 7:48 p.m.