lmerCorr.fit: lmer.fit function for the single correlation template model

Description Usage Arguments Examples

View source: R/pls.R

Description

lmer.fit function for the single correlation template model

Usage

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

Arguments

y

response vector

mmFE

model matrix for the fixed effects

corr

template correlation matrix for the single scalar random effect

grp

grouping factor for the random effect (levels correspond to dimnames of corr

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
18
19
library(lme4pureR)
library(lme4)
library(minqa)
library(subscript)
library(rmv)
set.seed(1)
n <- 100
x <- rnorm(n)
X <- cbind(1, x)
grp <- gl(n/5,5)
ugrps <- unique(grp)
q <- length(ugrps)
corr <- rcov(q+1,q)
dimnames(corr) <- rep(list(as.character(ugrps)), 2)
b <- as.numeric(rmv(1,corr) %*% as(grp, "sparseMatrix"))
y <- as.numeric(X%*%rnorm(ncol(X)) + b + rnorm(n))

m <- lmerCorr.fit(y, X, corr, grp)
m$par

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