Learn R Programming

VCA (version 1.5.1)

getL: Construct Linear Contrast Matrix for Hypothesis Tests

Description

Function constructs coefficient/contrast matrices from a string-representation of linear hypotheses.

Usage

getL(obj, s, what = c("fixef", "lsmeans"))

Value

(matrix) representing one linear hypothesis of fixed effects or LS Means per row

Arguments

obj

(VCA) object

s

(character) string or vector of strings, denoting one or multiple linear contrasts

what

(character) string specifying whether to construct contrast matrices of fixed effects ("fixed") or LS Means ("lsmeans"), abbreviations are allowed.

Author

Andre Schuetzenmeister andre.schuetzenmeister@roche.com

Details

Function constructs matrices expressing custom linear hypotheses of fixed effects or LS Means. The user has to specify a string denoting this contrast which is then transformed into a coefficient/contrast matrix. This string may contain names of fixed effects belonging to same same fixed term, numeric coefficients and mathematical operators "+" and "-" (see examples).

Examples

Run this code
if (FALSE) {
data(dataEP05A2_2)
fit <- anovaMM(y~day/(run), dataEP05A2_2)
L <- getL(fit, c("day1-day2", "day5-day10"), what="fixef")
L
test.fixef(fit, L=L)

# another custom hypothesis
L2 <- getL(fit, "0.25*day1+0.25*day2+0.5*day3-0.5*day4-0.5*day5")
L2

# more complex model
data(VCAdata1)
dataS2 <- VCAdata1[VCAdata1$sample==2,]
fit.S2 <- anovaMM(y~(lot+device)/day/(run), dataS2)
L3 <- getL(fit.S2, c("lot1-lot2", "lot1:device3:day19-lot1:device3:day20", 
"lot1:device1:day1-lot1:device1:day2"))
L3
test.fixef(fit.S2, L3)
}

Run the code above in your browser using DataLab