llcont.lmerMod: Extract Case-wise Log Likelihoods for Linear Mixed Effects...

View source: R/llcont.lmerMod.R

llcont.lmerModR Documentation

Extract Case-wise Log Likelihoods for Linear Mixed Effects Models

Description

A function for extracting the case-wise log likelihoods of a linear mixed effects model fitted via lme4. This function returns the case-wise log likelihoods, evaluated at the ML estimates.

Usage

## S3 method for class 'lmerMod'
llcont(x, ...)

Arguments

x

An object of class lmerMod.

...

additional arguments, including level (level = 2 is default; see details).

Value

If level = 2, a vector of log-likelihoods whose length is the number of clusters. If level = 1, a vector of length n, containing log-likelihoods for all n observations.

References

Wang, T. & Merkle, E. C. (2018). Derivative Computations and Robust Standard Errors for Linear Mixed Effects Models in lme4. Journal of Statistical Software, 87(1), 1-16. doi: 10.18637/jss.v087.c01

Merkle, E. C., You, D. and Preacher, K. J., 2016. Testing Nonnested Structural Equation Models. Psychological Methods, 21(2), 151. https://arxiv.org/pdf/1402.6720v3

Examples

## Not run: 
# The sleepstudy example
lme4fit <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy, REML = FALSE)

# clusterwise log likelihood
llcont(lme4fit)

## End(Not run)  

nctingwang/merDeriv documentation built on Aug. 17, 2022, 3:06 p.m.