devfun_mer: Deviance Function for Multilevel Models

Description Usage Arguments Details Value References Examples

View source: R/vcov_vc.R

Description

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

Usage

1
2
3

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 θ and σ. For devfun_mer2, a function with one argument theta that profiles out σ and only takes input of elements for θ.

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

1
2
3
4
5
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 April 20, 2018, 2:35 a.m.