lmer.fit: Fit a mixed effects from raw matrices, vectors and grouping...

Description Usage Arguments Examples

View source: R/pls.R

Description

The only output from this function is the result of an optimization over the covariance parameters.

Usage

1
lmer.fit(y, mmFE, mmRE, grp, weights, offset = numeric(n), REML = TRUE)

Arguments

y

response vector

mmFE

model matrix for the fixed effects

mmRE

template model matrix for the random effects (or optionally a list of such matrices)

grp

grouping factor for the random effects (or optionally a list of such factors)

weights

weights

offset

offset

REML

should restricted maximum likelihood be used?

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
library(lme4pureR)
library(lme4)
library(minqa)
set.seed(1)
n <- 1000
x <- rnorm(n)
z <- rnorm(n)
X <- cbind(1, x)
ZZ <- cbind(1, z)
grp <- gl(n/5,5)
RE <- mkRanefStructures(list(grp), list(ZZ))
Z <- t(RE$Zt)
y <- as.numeric(X%*%rnorm(ncol(X)) + Z%*%rnorm(ncol(Z)) + rnorm(n))
m <- lmer.fit(y,X,ZZ,grp)
m$par
Lambdat <- RE$Lambdat
Lambdat

lme4/lme4pureR documentation built on May 21, 2019, 7:34 a.m.