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

Description Usage Arguments Value Author(s) See Also Examples

View source: R/pairwise.R

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() to estimate them or used in explicit matricial calculus.

Usage

1
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 LE_matrix().

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

apmc(), LE_matrix().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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::LE_matrix() have an "grid" attribute.
attr(X, "grid") <- data.frame(n = LETTERS[1:nrow(X)])
rownames(X) <- NULL
apc(X)

walmes/wzRfun documentation built on Aug. 10, 2021, 2:19 p.m.