# NOT RUN {
#The sample size needed for 0.8 power when
#the standard deviation is 4 in each group,
#and the average treatment effect is 2.
sampleSize.rand(s1 = 4, s0 = 4, tau = 2)
#same as before, but when
#the average treatment effect is 0.8.
sampleSize.rand(s1 = 4, s0 = 4, tau = 0.8)
#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.rand(s1 = 4, s0 = 4, s.tau = 4, tau = 2)
#same as before, but when
#the average treatment effect is 0.8.
sampleSize.rand(s1 = 4, s0 = 4, s.tau = 4, tau = 0.8)
# }
Run the code above in your browser using DataLab