PowerAnalysis of CrossOver Study Using SIMR

Hello everyone,

Im trying to create a power analysis of a 2x2 CrossOver study using the SIMR package. I have been following this tutorial: https://humburg.github.io/Power-Analysis/simr_power_analysis.html but i am having trouble with the implementation of the wash-out period between treatments. I can not seem to figure out if i should include control measurements before each treatment intervention or if i should only include measurements after the two treatments. I have tried a few options, and in my code below you can see my most recent attempts of the implementation, but it does not seem to produce the results i was expecting. I hope some of you can help me figure out a better setup, or maybe identify some errors in my code.

subj = factor(1:14)
seq = c("AB","BA")
treat = c("C","C","A","B","C","C","B","A")
obs = 1:4

subj_full = rep(subj, 4)
seq_full = rep(rep(seq,each = 7), 4)
treat_full = rep(treat,each=7)
obs_full = rep(obs, each = 14)

df = data.frame(id = subj_full, sequence=seq_full, treatment=treat_full, observation=factor(obs_full))

#Specify fixed and random effects
b = c(4,0,0.1,0.2,1,0.9) #Intercept and slope
V1 = list(0.5, 0.2) #random intercept variance
s = 2 #residual standard deviation

#Building the model
model4 = makeLmer(y ~ treatment*observation + (1|sequence/id), fixef=b, VarCorr=V1, sigma=s, data=df)

sim_treat <- powerSim(model4, nsim=100, test = fcompare(y~observation*treatment))

This topic was automatically closed after 45 days. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.