adj_loglik: Loglikelihood adjustments for fitted models

Description Usage Arguments Details Value Supported models Available methods Examples References See Also

View source: R/adj_loglik_methods.R


This function adjusts the loglikelihood of fitted model objects based on Chandler and Bate (2007). It is a generic function for different types of models, which are listed in Supported models. This section also contains links to function-specific help pages.


adj_loglik(x, cluster = NULL, use_vcov = TRUE, use_mle = TRUE, ...)



A supported fitted model object, see Supported models


A vector or factor indicating the cluster the corresponding loglikelihood contribution belongs to. It is required to have the same length as the vector returned by logLik_vec(). If cluster is not supplied or NULL, then it is assumed that each observation forms its own cluster.


A logical scalar. By default, the vcov() method for x is used to estimate the Hessian of the independence loglikelihood, if the function exists. Otherwise, or if use_vcov = FALSE, H is estimated using stats::optimHess() inside chandwich::adjust_loglik().


A logical scalar. By default, the MLE from x is taken as given, and is not reestimated. By setting use_mle to FALSE, the parameters are reestimated in the function chandwich::adjust_loglik() using stats::optim().This feature is currently for development purposes only, may return misleading/false results and may be removed without notice.


Further arguments to be passed to sandwich::meatCL() if cluster is defined, if cluster = NULL, they are passed into sandwich::meat().


If use_vcov = TRUE, the current default, the function will test whether a vcov S3 method exists for x, and will take the variance-covariance matrix from there. Otherwise, or if use_vcov = FALSE the variance-covariance matrix of the MLE is estimated inside chandwich::adjust_loglik() using stats::optimHess().


An object of class "chantrics" inheriting from class "chandwich". See the documentation provided with chandwich::adjust_loglik().

Supported models

Available methods

"chantrics" objects have the following methods available to them:


See the model-specific pages in the supported models section.


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

See Also

lax::alogLik() supports adjustment for user-supplied objects.

chantrics documentation built on Sept. 29, 2021, 9:08 a.m.