Learn R Programming

lax (version 1.1.0)

alogLik: Loglikelihood adjustment for model fits

Description

This function is generic. It performs adjustment of the loglikelihood associated with fitted model objects, following Chandler and Bate (2007). Certain classes of extreme value model objects are supported automatically. For details see the alogLik help pages for the packages: evd, evir, extRemes, fExtremes, ismev, mev, POT, texmex. User-supplied objects can also be supported: the requirements for these objects are explained in Details.

Usage

alogLik(x, cluster = NULL, use_vcov = TRUE, ...)

Arguments

x

A fitted model object with certain associated S3 methods. See Details.

cluster

A vector or factor indicating from which cluster the respective loglikelihood contributions from loglik originate. This must have the same length as the vector returned by the logLikVec method for an object like x. If cluster is not supplied (i.e. is NULL) then it is assumed that each observation forms its own cluster. See Details.

use_vcov

A logical scalar. Should we use the vcov S3 method for x (if this exists) to estimate the Hessian of the independence loglikelihood to be passed as the argument H to adjust_loglik? Otherwise, H is estimated inside adjust_loglik using optimHess.

...

Further arguments to be passed to the functions in the sandwich package meat (if cluster = NULL), or meatCL (if cluster is not NULL).

Value

An object inheriting from class "chandwich". See adjust_loglik.

If x is one of the supported models then class(x) is a vector of length 5. The first 3 components are c("lax", "chandwich", "name_of_package"), where "name_of_package" is the name of the package from which the input object x originated. The remaining 2 components depend on the model that was fitted. See the documentation of the relevant package for details: evd, evir, extRemes, fExtremes, ismev, mev, POT, texmex.

Otherwise, class(x) is c("lax", "chandwich", class(x)).

Objects returned from `aloglik` have `anova`, `coef`, `confint`, `logLik`, `nobs`, `plot`, `print`, `summary` and `vcov` methods.

Examples

See the (package-specific) examples in evd, evir, extRemes,fExtremes, ismev, mev, POT and texmex.

Details

Object x must have the following S3 methods:

  • logLikVec: returns a vector of the contributions to the independence loglikelihood from individual observations;

  • coef: returns a vector of model coefficients, see coef;

  • nobs: returns the number of (non-missing) observations used in a model fit, see nobs;

and may have the following S3 methods

  • vcov: returns the estimated variance-covariance matrix of the (main) parameters of a fitted model, see vcov;

  • estfun: returns an \(n x k\) matrix, in which each column gives the derivative of the loglikelihood at each of \(n\) observation with respect to the \(k\) parameters of the model, see estfun.

Loglikelihood adjustment is performed using the adjust_loglik function in the chandwich package. The relevant arguments to adjust_loglik, namely loglik, mle, H and V, are created based on the class of the object x.

If a vcov method is not available, or if use_vcov = FALSE, then the variance-covariance matrix of the MLE (from which H is calculated) is estimated inside adjust_loglik using optimHess.

The sandwich package is used to estimate the variance matrix V of the score vector: meat is used if cluster = NULL; meatCL is used if cluster is not NULL. If cluster is NULL then any arguments of meatCL present in … will be ignored. Similarly, if cluster is not NULL then any arguments of meat present in … will be ignored. meat and meatCL require an estfun method to be available, which, in the current context, provides matrix of score contributions. If a bespoke estfun method is not provided then this is constructed by estimating the score contributions using jacobian.

References

Chandler, R. E. and Bate, S. (2007). Inference for clustered data using the independence loglikelihood. Biometrika, 94(1), 167-183. http://doi.org/10.1093/biomet/asm015

Zeleis (2006) Object-Oriented Computation and Sandwich Estimators. Journal of Statistical Software, 16, 1-16. http://doi.org/10.18637/jss.v016.i09

See Also

summary.chandwich, plot.chandwich, confint.chandwich, anova.chandwich, coef.chandwich, vcov.chandwich and logLik.chandwich for S3 methods for objects of class "chandwich".

conf_region for confidence regions for pairs of parameters.

adjust_loglik in the chandwich package to adjust a user-supplied loglikelihood.

meat and meatCL in the sandwich package.