library(SMARTAR) #R code and results: Example 1 data(codiacs) summary(codiacs) head(codiacs) #R code and results: Example 2 #Part 1 smartsize(delta=0.1213,df=5,global=TRUE,alpha=0.05,beta=0.20) #input effect size of global test directly #Part 2 #build sequence information matrix SEQ=seq(1,8) A1=c(0,0,0,0,1,1,1,1) PI1=rep(0.5,8) O2=c(0,0,1,1,0,0,1,1) P2=c(0.7,0.7,0.3,0.3,0.6,0.6,0.4,0.4) A2=c(0,1,0,1,0,1,0,1) PI2=rep(0.5,8) MEAN=c(1,8,11,10,9,6,20,12) SD=rep(10,8) SIMatrix=data.frame(SEQ,A1,PI1,O2,P2,A2,PI2,MEAN,SD) SIMatrix smartsize(sim=SIMatrix,global=TRUE,alpha=0.05,beta=0.20) #input sequence-inforamtion matrix for powering by global test #Part 3 smartsize(delta=0.90,global=FALSE,alpha=0.05,beta=0.20) #power a SMART based on a pairwise comparison #R code and results: Example 3 getncp(df=5,alpha=0.05,beta=0.20,d=0.0001,start=5) #R code and results: Example 4 seqmeans(data=codiacs,family="gaussian",digits=2,plot="d",pch=c(19,15), legend=c("Intermediate evaluation”,“Stage-specific treatment"), xlab="stage-specific treatment/evalution", title="(A) Design diagram of CODIACS") seqmeans(data=codiacs,family="gaussian",digits=2,plot="s", reference=TRUE, color="yellow", xlab="Treatment sequence", ylab="BDI reduction at 6 months", title="(B) Primary outcome by treatment sequence (A1,O2,A2)") #R code and results: Example 5 atsmeans(data=codiacs,family="gaussian",method="Gest",conf=TRUE,digits=2, alpha=0.05,plot=TRUE, title="Estimated values of depression management strategy in CODIACS", xlab="Strategy",ylab="BDI reduction") #R code and results: Example 6 smartest(data=codiacs,family="gaussian",method="Gest",digits=2,adjust="Bon")