Learn R Programming

ArrayTools (version 1.32.0)

contrastMatrix: Class to Contain the Contrast Matrix that Used for Linear Regression

Description

Class to Contain the Contrast Matrix that Used for Linear Regression, inherited from the designMatrix class

Arguments

Creating Objects

new("contrastMatrix", ..., design.matrix=[designMatrix], compare1=[character], compare2=[character], level=[character], interaction==[numeric]). This creates a contrast matrix class. design.matrix is a designMatrix class. compare1 the first value of the main covariate, and compare2 is the second value of the main covariate. For example, suppose that the main covariate is "drug", and there are three unique values: "drug1", "drug2", and "placebo". You would like to compare "drug1" to "drug2". Then you would use "drug1" as compare1 and "drug2" as compare2. If interaction==TRUE, do not specify compare1 and compare2. You only specify level when the design matrix contains an interaction term. Suppose that you would like to compare "drug1" to "drug2" only when estrogen is "present", where "present" is one of the values of the estrogen variable. You will use "present" as level. If interaction==TRUE, do not specify this value as well. You only specify interaction=TRUE when you would like to detect the interaction effect between two covariates. In this case, do not provide values for compare1, compare2, and level

Slots

contrast:
Object of class "matrix" contains the contrast matrix
compare1:
Object of class "character" contains compare1
compare2:
Object of class "character" contains compare2
level:
Object of class "character" contains level
interaction:
Object of class "logical" contains interaction
design:
Object of class "matrix" contain the design matrix
target:
Object of class "data.frame" contains target
covariates:
Object of class "character" contains covariates
intIndex:
Object of class "numeric" contains intIndex

Extends

Class "designMatrix", directly.

Methods

getCompare1
signature(object = "contrastMatrix"): access the compare1 slot
getCompare2
signature(object = "contrastMatrix"): access the compare2 slot
getContrast
signature(object = "contrastMatrix"): access the contrast slot
getInteraction
signature(object = "contrastMatrix"): access the interaction slot
getLevel
signature(object = "contrastMatrix"): access the level slot
initialize
signature(.Object = "contrastMatrix"): create a new contrast matrix class
show
signature(object = "contrastMatrix"): print the contrast matrix

See Also

designMatrix

Examples

Run this code
data(eSetExample)
## One-way Anova
(design1<- new("designMatrix", target=pData(eSetExample), covariates = "Treatment"))
(contrast1<- new("contrastMatrix", design.matrix = design1, 
    compare1 = "Treated", compare2 = "Control"))
	
## Randomized block design
(design2<- new("designMatrix", target=pData(eSetExample), 
   covariates = c("Treatment", "Group")))
(contrast2<- new("contrastMatrix", design.matrix = design2, 
    compare1 = "Treated", compare2 = "Control"))

## Interaction design
(design3<- new("designMatrix", target=pData(eSetExample), 
   covariates = c("Treatment", "Group"), intIndex=c(1,2)))
# Test for interaction:
(contrast.int<- new("contrastMatrix", design.matrix = design3,
    interaction=TRUE))
# Compare Treated vs Control among group A
(contrast.a<- new("contrastMatrix", design.matrix = design3, 
    compare1 = "Treated", compare2 = "Control", level="A"))

Run the code above in your browser using DataLab