alogLik.lm: Loglikelihood adjustment of Linear Model fits

Description Usage Arguments Examples

Description

Loglikelihood adjustment of Linear Model fits

Usage

1
2
3
## S3 method for class 'lm'
alogLik(x, cluster = NULL, use_sandwich = TRUE,
  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 object like x. If cluster is not supplied then it is assumed that each observation forms its own cluster.

If the sandwich package (Zeleis, 2006) is used to estimate the quantities required to adjust the loglikelihood (i.e. use_sanswich = TRUE) then cluster determines whether the variance matrix V of the score vector is estimated using meat (cluster is NULL) or meatCL (cluster is not NULL). See use_sandwich and Details.

use_sandwich

A logical scalar. Should we use the sandwich package (Zeleis, 2006) to estimate the variance V of the score function to be passed as the argument V to adjust_loglik? Otherwise, V is based on numerical derivatives, estimated using the numDeriv package. See Details for more information.

The main purpose of use_sandwich is to enable a check that equivalent results are obtained using the sandwich package and the numerical derivatives.

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, otherwise.

Examples

1
2
3
data(PetersenCL, package = "sandwich")
p_lm <- lm(y ~ x, data = PetersenCL)
#adj_p_lm <- alogLik(p_lm) (doesn't work yet)

paulnorthrop/oola documentation built on May 12, 2019, 10:52 a.m.