Zsection: Create a section of a transposed random effects model matrix

Description Usage Arguments Value Examples

View source: R/pls.R

Description

Create a section of a transposed random effects model matrix

Usage

1
Zsection(grp, mm)

Arguments

grp

Grouping factor for a particular random effects term.

mm

Dense model matrix for a particular random effects term.

Value

Section of a random effects model matrix corresponding to a particular term.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## consider a term (x | g) with:
## number of observations, n = 6
## number of levels, nl = 3
## number of columns ('predictors'), nc = 2
(X <- cbind("(Intercept)"=1,x=1:6)) # an intercept in the first column and 1:6 predictor in the other
(g <- as.factor(letters[rep(1:3,2)])) # grouping factor
nrow(X) # n = 6
nrow(X) == length(g) # and consistent n between X and g
ncol(X) # nc = 2
nlevels(g) # nl = 3
Zsection(g, X)

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