Contrast Matrix for LS Means.

Share:

Description

Function determines appropriate contrast matrix for computing the LS Means of each factor level of one or multiple fixed effects variables.

Usage

1
lsmMat(obj, var = NULL, quiet = FALSE)

Arguments

obj

(VCA) object

var

(character) string specifyig the fixed effects variable for which the LS Means generating matrices should be computed

quiet

(logical) TRUE = will suppress any warning, which will be issued otherwise

Details

This functions implements the 5 rules given in the documentation of SAS PROC GLM for computing the LS Means.#' The LS Means correspond to marginal means adjusted for bias introduced by unbalancedness.

Value

(matrix) where each row corresponds to a LS Means generating contrast for each factor level of one or multiple fixed effects variable(s)

Author(s)

Andre Schutzenmeister andre.schuetzenmeister@roche.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
data(dataEP05A2_1)
fit1 <- anovaMM(y~day/run, dataEP05A2_1)

VCA:::lsmMat(fit1, "day")	# function not exported
VCA:::lsmMat(fit1, "run")
VCA:::lsmMat(fit1)			# is equal to listing all fixed terms

# a more complex and unbalanced model
data(VCAdata1)
datS1 <- VCAdata1[VCAdata1$sample == 1, ]
set.seed(42)
datS1ub <- datS1[-sample(1:nrow(datS1))[1:25],]
fit2 <- anovaMM(y~(lot+device)/day/(run), datS1ub)
VCA:::lsmMat(fit2, c("lot", "device"))

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.