Learn R Programming

QTLRel (version 1.14)

rem: Random effect matrices

Description

Construct matrices associated with random effects.

Usage

rem(formula,data)

Value

A list of matrices that are associated with random effects.

Arguments

formula

A formula of the form: ~ Z | G1/.../Gk + ..., corresponding to random effects Z*G_i + Z*G_{ij} + ... in a mixed effect model. If Z=1 as in most cases, then it can be ~ G1/.../Gk + ...

data

A data frame that contains all the variables in the formula.

Examples

Run this code
if (FALSE) {
# make-up example
dat<- data.frame(
   group=c("A","A","A","A","A","A","B","B","B","B"),
   sex=c("F","F","F","M","M","M","F","F","M","M"),
   pass=c("Y","N","N","Y","Y","Y","Y","N","N","Y"),
   z=1:10)

# random effect pass, group and sex, where sex is nested
# within group:
# y_{ijk} = x_{ij}*b + group_i + sex_{ij} + z*pass_{ij}
#           + e_{ijk}
rem(~ group/sex + z|pass,data=dat)
}

Run the code above in your browser using DataLab