makeContrast: Create a contrast matrix

View source: R/makeContrast.R

makeContrastR Documentation

Create a contrast matrix

Description

This function returns a contrast matrix corresponding to specified contrasts of a set of parameters. In order to view all possible predictor levels of a specific model, use attr(mymodel,"MSqRob_levels"), e.g. attr(getModels(modelRRCPTAC[1]),"MSqRob_levels"). The matrix specifies which comparisons between the coefficients are to be extracted from the fit. The output from this function is usually used as input to the test.protLMcontrast function.

Usage

makeContrast(contrasts, levels)

Arguments

contrasts

A character vector specifying containing each contrast of interest.

levels

A character vector containing the parameter levels to be used in 1 or more contrasts.

Value

A contrast matrix with the parameter levels as rows and a column for each contrast.

Examples

#Create a contrast matrix L for investigating whether all 10 pairwise contrasts between conditions conc6A, conc6B, conc6D and conc6E differ from zero:
L <- makeContrast(contrasts=c("conc6B-conc6A","conc6C-conc6A","conc6D-conc6A","conc6E-conc6A","conc6C-conc6B","conc6D-conc6B","conc6E-conc6B","conc6D-conc6C","conc6E-conc6C","conc6E-conc6D"),
levels=c("conc6A","conc6B","conc6C","conc6D","conc6E"))
#Create a contrast matrix L for investigating whether the size of the effects conc6A, conc6B, conc6D and conc6E differs from zero:
L <- makeContrast(contrasts=c("conc6A","conc6B","conc6C","conc6D","conc6E"),
levels=c("conc6A","conc6B","conc6C","conc6D","conc6E"))
#Create a contrast matrix L for investigating whether the size of conc6A minus 2 times conc6B differs from zero:
L <- makeContrast(contrasts=c("conc6A-2*conc6B"),
levels=c("conc6A","conc6B","conc6C","conc6D","conc6E"))

statOmics/MSqRob documentation built on Dec. 8, 2022, 6 a.m.