Learn R Programming

statforbiology (version 0.9.9)

contr.Tukey: Pairwise contrast matrix

Description

Returns a matrix of Tukey-type contrasts (all-pairwise)

Usage

contr.Tukey(n, names = NULL)

Value

A matrix with n columns and n(n-1)/2 rows

Arguments

n

an integer: the number of levels, corresponding to the number of columns in the output matrix

names

a vector of names with same length as n

Author

Andrea Onofri

Details

This functions is used for creating contrast matrices for use with glht or other methods for fitting linear contrasts. The rows of the resulting matrices contain the coefficients of contrasts relating to a factor with n levels. The names of the levels can be optionally given with the argument 'names', other wise they default to the numbers from 1 to n.

Examples

Run this code
contr.Tukey(8, LETTERS[1:8])

Run the code above in your browser using DataLab