testVarCom: Wald Test to check variances are equal or not

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/testVarCom.R

Description

Testing whether the group specific variances are the same or not.

Usage

1
testVarCom(ObjPamFit)

Arguments

ObjPamFit

Output object from the PamGeneMix.

Value

A list

A list with p-value(s) of the test. And estimated variances and their standard errors for each group. If there are no groups then NA will be returned.

Author(s)

Pushpike Thilakarathne, Ziv Shkedy and Dan Lin

References

Engle, Robert F. (1983). "Wald, Likelihood Ratio, and Lagrange Multiplier Tests in Econometrics". In Intriligator, M. D.; and Griliches, Z.. Handbook of Econometrics. II. Elsevier. pp. 796-801. ISBN 978-0-444-86185-6.

See Also

PamGeneMix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
data(TestPepModelData)


PTx<-TestPepModelData


# log2 transform the response 
PTx$y<-log2(PTx[,ncol(PTx)]) 

# we now create interaction between ResState and Treatment as follows.

n.groups<-length(unique(PTx[,c("ResState")]))*length(unique(PTx[,c("TreatName")]))
PTx$ResTrt<-0
xhlp<-lm(y~-1+ResState:TreatName,data=PTx,x=TRUE)$x
for (i in 1:n.groups) PTx$ResTrt[xhlp[,i]==1]<-i
PTx$ResTrt<-as.factor(PTx$ResTrt)
levels(PTx$ResTrt)<-colnames(xhlp)

#unique cell lines
cellLines<-levels(PTx$CellName)
PTx$ResState<-as.factor(PTx$ResState)

# create interaction between Treatment and cell lines
PTx$CellLineResTrt<-0
xhlp<-lm(y~-1+CellName:TreatName,data=PTx,x=TRUE)$x
ncols<-ncol(xhlp)
for (i in 1:ncols) PTx$CellLineResTrt[xhlp[,i]==1]<-i
PTx$CellLineResTrt<-as.factor(PTx$CellLineResTrt)
levels(PTx$CellLineResTrt)<-colnames(xhlp)

M3gamm<-PamGeneMix(formula=y~-1+ResTrt+s(time,by=ResTrt,bs="tp",m=3),Weights=varIdent(form=~1|ResTrt) ,
PTx=PTx,Random.structure=list(ArrayNum=~-1,CellLineResTrt=~1+time+time2,ID=~1+time+time2),
Control.list=list(maxIter=200, msMaxIter=250 ,msMaxEval=1000,apVar=TRUE))

#we can now use testVarCom function to test the hypothesis that 
#H0: Var(group_R_i) - Var(group_R_j) = 0 and  Var(group_NR_i) - Var(group_NR_j) = 0. 
#That is testing for treatment effects conditional on the responsive statues 

testVarCom(M3gamm)  

pamgene/PamGeneMixed documentation built on Dec. 31, 2020, 1:13 a.m.