# NOT RUN {
#analysis original data
data_o <- data.frame(y=ChickWeight$weight,g=ChickWeight$Diet)
#compute pooled sd
sd.g <- aggregate(data_o$y,by=list(data_o$g),sd)[,2]
n.g <- table(data_o$g)
p.sd<- pooled.sd(data_o)
post <- Gibbs.ANOVA(data_o)
#create matrices HR: g4>(g1,g2,g3). g4-g1>0.8, g4-g2>0.5, g4-g3>0.2
HR <- create_matrices(varnames = c("g1","g2","g3","g4"),
hyp = "g4-g1>0.8 & g4-g2>0.5 & g4-g3>0.2")
Amat <- HR$Amat
difmin <- HR$difmin
#sample size calculator
sample.size.calc(start_n=30, powtarget=.825,powmargin=.025,posterior=post$posterior,
g.m=rep(mean(data_o$y),4),p.sd=p.sd,
statistic="dif",effectsize=TRUE,Amat=Amat,difmin=difmin)
# }
Run the code above in your browser using DataLab