Repeated measures ANOVA

Share:

Description

Constructs a repeated measures ANOVA model.

Usage

1
rmANOVA(DV,family=NO(),between,within,N,mu,bsigma,wsigma,nu,tau,id.name="ID",display.direction=c("wide","long"))

Arguments

DV

either a list or a RandomVariable

.

family

a gamlss.family object

between

(optional) either a data.frame or VariableList containing the factors of the between subjects design.

within

either a data.frame or VariableList containing the factors of the between subjects design.

N

a vector with the number of observations in each cell of the design.

mu

a matrix with the means in each cell of the design.

bsigma

a vector with the standard deviations in each cell of the between design.

wsigma

a vector with the standard deviations in each cell of the within design.

nu

a vector with the standard deviations in each cell of the within design.

tau

a vector with the standard deviations in each cell of the within design.

id.name

a string with the name of the variable used to differentiate subjects.

display.direction

a string indicating whether the data will be in long or wide format (internally, the model always uses a long format.)

Details

The rmANOVA function constructs a repeated measures ANOVA model.

Value

An object of class rmANOVA (directly extending the SimDatModel class).

Author(s)

Maarten Speekenbrink

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
# a 2*2*2*2 factorial ANOVA with repeated measures on the last two factors 
mod <- rmANOVA(between=data.frame(A=factor(c(1,1,2,2),labels=c("A1","A2")),B=factor(c(1,2,1,2),labels=c("B1","B2"))),within=data.frame(V=factor(c(1,1,2,2),labels=c("V1","V2")),W=factor(c(1,2,1,2),labels=c("W1","W2"))),N=rep(10,4),mu=cbind(c(0,1,2,3),c(1,2,3,4),c(3,4,5,6),c(6,7,8,9)),bsigma=c(1,1,1,1),wsigma=c(1,1,1,1),nu=NULL,tau=NULL,DV=list(name="Y",min=-Inf,max=Inf,digits=8),family=NO(),id.name="ID",display.direction=c("wide","long"))
mod <- simulate(mod)

# a completely within ANOVA
mod <- rmANOVA(within=data.frame(V=factor(c(1,1,2,2),labels=c("V1","V2")),W=factor(c(1,2,1,2),labels=c("W1","W2"))),N=rep(1000,1),mu=matrix(c(0,1,2,3),nrow=1),bsigma=c(100),wsigma=c(1,1,1,1),nu=NULL,tau=NULL,DV=list(name="Y",min=-Inf,max=Inf,digits=8),family=NO(),id.name="ID",display.direction=c("wide","long"))
mod <- simulate(mod)


# create two factors and put them into a variablelist
f1 <- NominalVariable(factor(c(1,1,2,2),labels=c("A1","A2")),name="A")
f2 <- NominalVariable(factor(c(1,2,2,3),labels=c("B1","B2","B3")),name="B")
bdesign <- VariableList(list(f1,f2))
# create two factors and put them into a variablelist
f1 <- NominalVariable(factor(c(1,1,2,2),labels=c("W1","W2")),name="W")
f2 <- NominalVariable(factor(c(1,2,1,2),labels=c("V1","V2")),name="V")
wdesign <- VariableList(list(f1,f2))
# and a random interval variable
d <- RandomIntervalVariable(numeric(1),name="Y",min=-10,max=Inf,digits=2)
# means
mu <- cbind(c(10,15,15,20),c(20,25,25,30),c(10,15,15,20),c(30,25,20,25))

mod2 <- rmANOVA(DV=d,family=NOF(),between=bdesign,within=wdesign,N=rep(15,4),mu=mu,bsigma=c(2,3,4,5),wsigma=c(1,2,3,4),nu=c(1,1,1,1))
mod2 <- simulate(mod2)