Learn R Programming

RVAideMemoire (version 0.9-27)

mat.cont: Matrix of contrasts generation

Description

Return a matrix for pairwise comparisons with the contrasts method.

Usage

mat.cont(f, ref = NULL, restrict = NULL, exclude = FALSE)

Arguments

f
factor giving the groups to be compared.
ref
optional reference level (only contrasts involving this level are generated).
restrict
optional vector of levels (only contrasts involving these levels are generated).
exclude
logical. If TRUE and if restrict is not NULL, levels which are not involved in comparisons are not present in the matrix (to be used when the model has been generated with the subset option).

See Also

esticon, adjust.esticon

Examples

Run this code
# A factor with 5 levels
fact <- gl(5,10,labels=LETTERS[1:5])

# A matrix of contrasts with all possible pairwise comparisons
mat.cont(fact)

# A matrix with only comparisons to level "A"
mat.cont(fact,ref="A")

# A matrix with all pairwise comparisons between "A", "B" and "E"
mat.cont(fact,restrict=c("A","B","E"))

# The same with levels "C" and "D" excluded
mat.cont(fact,restrict=c("A","B","E"),exclude=TRUE)

Run the code above in your browser using DataLab