# NOT RUN {
#The sample size needed for 0.8 power when
#the standard deviation is 4 in each group,
#the average treatment effect is 2,
#there are 50 covariates, and R2 = 0.3.
sampleSize.rerand(s1 = 4, s0 = 4, tau = 2,
K = 50, R2 = 0.3, pa = 0.01)
#same as before, but when
#the average treatment effect is 0.8.
sampleSize.rerand(s1 = 4, s0 = 4, tau = 0.8,
K = 50, R2 = 0.3, pa = 0.01)
#The same examples as above,
#but now with treatment effect heterogeneity.
#We set the standard deviation of treatment effects
#to be that of potential outcomes.
#Note that, compared to the previous examples,
#sample size always decreases.
#This will always happen when power > 0.5;
#this is discussed in Branson, Li, and Ding (2022).
sampleSize.rerand(s1 = 4, s0 = 4, s.tau = 4, tau = 2,
K = 50, R2 = 0.3, pa = 0.01)
#same as before, but when
#the average treatment effect is 0.8.
sampleSize.rerand(s1 = 4, s0 = 4, s.tau = 4, tau = 0.8,
K = 50, R2 = 0.3, pa = 0.01)
# }
Run the code above in your browser using DataLab