Function to help build the contrast matrix

Description

dContrast is used to help build the contrast matrix

Usage

dContrast(level_sorted, contrast.type = c("average", "zero", "sequential", "pairwise"))

Arguments

level_sorted
a vector of levels (usually sorted) which are contrated to each other
contrast.type
the type of the contrast. It can be one of either 'average' for the contrast against the average of all levels, 'zero' for the contrast against the zero, 'sequential' for the contrast in a sequential order (it requires the levels being sorted properly), or 'pairwise' for the pairwise contrast.

Value

a list with following components:

  • each: the contrast being specified
  • name: the name of the contrast

Note

none

Examples

level_sorted <- c("L1","L2","L3","L4") # the contrast against the average of all levels contrasts <- dContrast(level_sorted, contrast.type="average") # the contrast against the zero contrasts <- dContrast(level_sorted, contrast.type="zero") # the contrast in a sequential order contrasts <- dContrast(level_sorted, contrast.type="sequential") # the pairwise contrast contrasts <- dContrast(level_sorted, contrast.type="pairwise")

Source code

dContrast.r

Source man

dContrast.Rd dContrast.pdf