apc: Generate Matrix of All Pairwise Comparisons (Tukey contrasts)

View source: R/apc.R

apcR Documentation

Generate Matrix of All Pairwise Comparisons (Tukey contrasts)

Description

This function takes a matrix where each line defines a linear function of the parameters to estimate a marginal mean (aka least squares mean) and return the matrix that define the contrasts among these means. All pairwise contrasts are returned (aka Tukey contrasts). The matrix with these contrasts can be passed to glht::multcomp() to estimate them or used in explicit matricial calculus.

Usage

apc(lfm, lev = NULL)

Arguments

lfm

a k \times p matrix where each line defines a linear function to estimate a lsmean. In general, these matrices are obtained by using doBy::LSmatrix().

lev

a character vector with length equals to the numbers of lines of lfm matrix, (k). Default is NULL and the row names of codelfm is used. If row names is also NULL, incremental integer values are used to identify the comparisons.

Value

a K\times p matrix with the linear functions that define all pairwise contrasts. K is {k}\choose{2}.

Author(s)

Walmes Zeviani, walmes@ufpr.br.

See Also

doBy::LSmatrix().

Examples


X <- diag(3)
rownames(X)
apc(X)

rownames(X) <- letters[nrow(X):1]
apc(X)

apc(X, lev = LETTERS[1:nrow(X)])

# Objects from doBy::LSmatrix() have an "grid" attribute.
attr(X, "grid") <- data.frame(n = LETTERS[1:nrow(X)])
rownames(X) <- NULL
apc(X)


htmcglm documentation built on July 21, 2022, 5:10 p.m.