lme4 (version 0.4-7)

LMEgradient: The gradient and Hessian in lme optimization-method

Description

The LMEgradient and LMEhessian generic functions return the gradient and the Hessian of the log-likelihood or log-restricted-likelihood in an lme model with respect to the parameters of the object represented by x.

Usage

LMEgradient(x, A, nlev)
LMEhessian(x, A, H, nlev)

Arguments

x
a parameterized component of an lme model, usually the precision matrix of an lmeLevel. Such precision matrices inherit from the pdMat class.
A
an upper triangular matrix with the same number of columns as the matrix represented by x
H
an array of four dimensions with each dimension same as the number of columns of the matrix represented by x
nlev
integer: the number of levels of the grouping factor corresponding to the random-effects structure

Value

  • LMEgradient returns a numeric vector of length length(coef(x)).

    LMEhessian returns a symmetric matrix with number of columns length(coef(x)).

See Also

pdMat-class, lmeLevel-class

Examples

Run this code
library(lme4)
data(Oxboys)
m3 <- pdLogChol(~ age)
as(m3, 'pdmatrix') <- crossprod(model.matrix(formula(m3), as(Oxboys, "data.frame")))
LMEgradient(m3, diag(2), 19)

Run the code above in your browser using DataCamp Workspace