devfun_mer: Deviance Function for Multilevel Models

View source: R/vcov_vc.R

devfun_merR Documentation

Deviance Function for Multilevel Models

Description

Creates a deviance function for a fitted model object, using \theta and sigma as the parameters.

Usage

devfun_mer(x)

devfun_mer2(x)

Arguments

x

A fitted merMod object from lmer.

Details

The built-in function(s) in lme4 for generating deviance function are not exported and rely on C++ code. This function is mainly used to obtain Hessian and asymptotic covariance matrix of the random effects.

Value

A deviance function with one argument th_sig that takes input of a numeric vector corresponding to the some estimated values of \theta and \sigma. For devfun_mer2, a function with one argument theta that profiles out \sigma and only takes input of elements for \theta.

References

Bates, D., M\"achler, M., Bolker, B. M., & Walker, S. C. Fitting linear mixed-effects models using lme4. Retrieved from https://cran.r-project.org/web/packages/lme4/vignettes/lmer.pdf

Implementation in lme4pureR: https://github.com/lme4/lme4pureR/blob/master/R/pls.R

Examples

library(lme4)
fm01ML <- lmer(Yield ~ (1 | Batch), Dyestuff, REML = FALSE)
dd <- devfun_mer(fm01ML)
# Asymptotic variance-covariance matrix of (theta, sigma):
2 * solve(numDeriv::hessian(dd, c(fm01ML@theta, sigma(fm01ML))))

marklhc/bootmlm documentation built on May 24, 2023, 9:59 a.m.