rm2mcp <-
function(J,K,x,est=tmean,alpha=.05,grp=NA,dif=TRUE,nboot=NA,
plotit=FALSE,BA=FALSE,hoch=FALSE,...){
#
# This function performs multiple comparisons for
# dependent groups in a within by within designs.
# It creates the linear contrasts and call calls rmmcppb
# only it is assumed that main effects and interactions for a
# two-way design are to be tested.
#
# The data are assumed to be stored in x in list mode or in a matrix.
# If grp is unspecified, it is assumed x[[1]] contains the data
# for the first level of both factors: level 1,1.
# x[[2]] is assumed to contain the data for level 1 of the
# first factor and level 2 of the second factor: level 1,2
# x[[j+1]] is the data for level 2,1, etc.
# If the data are in wrong order, grp can be used to rearrange the
# groups. For example, for a two by two design, grp<-c(2,4,3,1)
# indicates that the second group corresponds to level 1,1;
# group 4 corresponds to level 1,2; group 3 is level 2,1;
# and group 1 is level 2,2.
#
# Missing values are automatically removed.
#
JK <- J * K
if(is.matrix(x))
x <- listm(x)
if(!is.na(grp[1])) {
yy <- x
for(j in 1:length(grp))
x[[j]] <- yy[[grp[j]]]
}
if(!is.list(x))
stop("Data must be stored in list mode or a matrix.")
for(j in 1:JK) {
xx <- x[[j]]
# xx[[j]] <- xx[!is.na(xx)]
x[[j]] <- xx[!is.na(xx)]
}
#
# Create the three contrast matrices
#
temp<-con2way(J,K)
conA<-temp$conA
conB<-temp$conB
conAB<-temp$conAB
ncon <- max(nrow(conA), nrow(conB), nrow(conAB))
FacA<-rmmcppb(x,con=conA,est=est,plotit=plotit,dif=dif,grp=grp,
nboot=nboot,BA=TRUE,hoch=FALSE,...)
FacB<-rmmcppb(x,con=conB,est=est,plotit=plotit,dif=dif,grp=grp,
nboot=nboot,BA=TRUE,hoch=FALSE,...)
FacAB<-rmmcppb(x,con=conAB,est=est,plotit=plotit,dif=dif,grp=grp,
nboot=nboot,BA=TRUE,hoch=FALSE,...)
list(Factor.A=FacA,Factor.B=FacB,Factor.AB=FacAB)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.