# continuous predictor x (and 4 covariates)
power.t.regression(beta = 0.20,
k.total = 5,
r.squared = 0.30,
power = 0.80)
# binary predictor x (and 4 covariates)
p <- 0.50 # proportion of subjects in one group
power.t.regression(beta = 0.20,
sd.predictor = sqrt(p * (1 - p)),
k.total = 5,
r.squared = 0.30,
power = 0.80)
# non-inferiority test with binary predictor x (and 4 covariates)
p <- 0.50 # proportion of subjects in one group
power.t.regression(beta = 0.20, # Cohen's d
margin = -0.05, # non-inferiority margin in Cohen's d unit
alternative = "one.sided",
sd.predictor = sqrt(p*(1-p)),
k.total = 5,
r.squared = 0.30,
power = 0.80)
# superiority test with binary predictor x (and 4 covariates)
p <- 0.50 # proportion of subjects in one group
power.t.regression(beta = 0.20, # Cohen's d
margin = 0.05, # superiority margin in Cohen's d unit
alternative = "one.sided",
sd.predictor = sqrt(p * (1 - p)),
k.total = 5,
r.squared = 0.30,
power = 0.80)
# equivalence test with binary predictor x (and 4 covariates)
p <- 0.50 # proportion of subjects in one group
power.t.regression(beta = 0, # Cohen's d
margin = c(-0.05, 0.05), # equivalence bounds in Cohen's d unit
alternative = "two.one.sided",
sd.predictor = sqrt(p * (1 - p)),
k.total = 5,
r.squared = 0.30,
power = 0.80)
Run the code above in your browser using DataLab