contrastMatrix {ArrayTools} | R Documentation |
Class to Contain the Contrast Matrix that Used for Linear Regression, inherited from the designMatrix class
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
contrast
:"matrix"
contains the contrast matrixcompare1
:"character"
contains compare1
compare2
:"character"
contains compare2
level
:"character"
contains level
interaction
:"logical"
contains interaction
design
:"matrix"
contain the design matrixtarget
:"data.frame"
contains target
covariates
:"character"
contains covariates
intIndex
:"numeric"
contains intIndex
Class "designMatrix"
, directly.
signature(object = "contrastMatrix")
:
access the compare1
slotsignature(object = "contrastMatrix")
:
access the compare2
slotsignature(object = "contrastMatrix")
:
access the contrast
slot signature(object = "contrastMatrix")
:
access the interaction
slotsignature(object = "contrastMatrix")
:
access the level
slot signature(.Object = "contrastMatrix")
:
create a new contrast matrix class signature(object = "contrastMatrix")
: print the contrast matrix Xiwei Wu, Arthur Li
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"))