R/med3mcp.R

med3mcp <-
function(J,K,L,data,tr=.2,grp=c(1:p),alpha=.05,p=J*K*L,nboot=NA,
SEED=TRUE,bhop=FALSE){
#
#  Multiple comparisons for a  three-way anova, independent groups,
#  based on medians using a percentile bootstrap method
#
#  That is, there are three factors with a total of JKL independent groups.
#
#  The variable data is assumed to contain the raw
#  data stored in a matrix or in list mode.
#  If in list modde, data[[1]] contains the data
#  for the first level of all three factors: level 1,1,1.
#  data][2]] is assumed to contain the data for level 1 of the
#  first two factors and level 2 of the third factor: level 1,1,2
#  data[[L]] is the data for level 1,1,L
#  data[[L+1]] is the data for level 1,2,1. data[[2L]] is level 1,2,L.
#  data[[KL+1]] is level 2,1,1, etc.
#
#  It is assumed that data has length JKL, the total number of
#  groups being tested.
#
if(SEED)set.seed(2)
if(is.list(data))data=listm(elimna(matl(data)))
if(is.matrix(data))data=listm(elimna(data))
if(!is.list(data))stop("Data are not stored in list mode or a matrix")
if(p!=length(data)){
print("The total number of groups, based on the specified levels, is")
print(p)
print("The number of groups in data is")
print(length(data))
print("Warning: These two values are not equal")
}
temp=con3way(J,K,L)
conA<-temp$conA
conB<-temp$conB
conC<-temp$conC
conAB<-temp$conAB
conAC<-temp$conAC
conBC<-temp$conBC
conABC=temp$conABC
Factor.A<-medpb(x,con=conA,alpha=alpha,nboot=nboot,bhop=bhop)
Factor.B<-medpb(x,con=conB,alpha=alpha,nboot=nboot,bhop=bhop)
Factor.C<-medpb(x,con=conC,alpha=alpha,nboot=nboot,bhop=bhop)
Factor.AB<-pbtrmcp(x,con=conAB,alpha=alpha,nboot=nboot,bhop=bhop)
Factor.AC<-medpb(x,con=conAC,alpha=alpha,nboot=nboot,bhop=bhop)
Factor.BC<-medpb(x,con=conBC,alpha=alpha,nboot=nboot,bhop=bhop)
Factor.ABC<-medpb(x,con=conABC,alpha=alpha,nboot=nboot,bhop=bhop)
list(Factor.A=Factor.A,Factor.B=Factor.B,Factor.C=Factor.C,
Factor.AB=Factor.AB,Factor.AC=Factor.AC,Factor.BC=Factor.BC,
Factor.ABC=Factor.ABC)
}
musto101/wilcox_R documentation built on May 23, 2019, 10:52 a.m.