pwrss.t.reg {pwrss} | R Documentation |
Linear Regression: Single Coefficient (t or z Test)
Description
Calculates statistical power or minimum required sample size (only one can be NULL at a time) to test a single coefficient in multiple linear regression. The predictor is assumed to be continuous by default. However, one can find statistical power or minimum required sample size for a binary predictor (such as treatment and control groups in an experimental design) by specifying sdx = sqrt(p*(1-p))
where p
is the proportion of subjects in one of the groups. The sample size in each group would be n*p
and n*(1-p)
. pwrss.t.regression()
and pwrss.t.reg()
are the same functions.
When HIGHER values of an outcome is a good thing, beta1
is expected to be greater than beta0 + margin
for non-inferiority and superiority tests. In this case, margin
is NEGATIVE for the non-inferiority test but it is POSITIVE for the superiority test.
When LOWER values of an outcome is a good thing, beta1
is expected to be less than beta0 + margin
for non-inferiority and superiority tests. In this case, margin
is POSITIVE for the non-inferiority test but it is NEGATIVE for the superiority test.
For equivalence tests the value of beta0
shifts both to the left and right as beta0 - margin
and beta0 + margin
. For equivalence tests margin
is stated as the absolute value and beta1
is expected to fall between beta0 - margin
and beta0 + margin
.
Formulas are validated using Monte Carlo simulation, G*Power, tables in PASS documentation, and tables in Bulus (2021).
Usage
pwrss.t.reg(beta1 = 0.25, beta0 = 0, margin = 0,
sdx = 1, sdy = 1,
k = 1, r2 = (beta1 * sdx / sdy)^2,
alpha = 0.05, n = NULL, power = NULL,
alternative = c("not equal", "less", "greater",
"non-inferior", "superior", "equivalent"),
verbose = TRUE)
pwrss.z.reg(beta1 = 0.25, beta0 = 0, margin = 0,
sdx = 1, sdy = 1,
k = 1, r2 = (beta1 * sdx / sdy)^2,
alpha = 0.05, n = NULL, power = NULL,
alternative = c("not equal", "less", "greater",
"non-inferior", "superior", "equivalent"),
verbose = TRUE)
Arguments
beta1 |
expected regression coefficient. One can use standardized regression coefficient, but should keep |
beta0 |
regression coefficient under null hypothesis (usually zero). Not to be confused with the intercept. One can use standardized regression coefficient, but should keep |
margin |
non-inferiority, superiority, or equivalence margin (margin: boundry of |
sdx |
expected standard deviation of the predictor. For a binary predictor, |
sdy |
expected standard deviation of the outcome |
k |
(total) number of predictors |
r2 |
expected model R-squared. The default is |
n |
total sample size |
power |
statistical power |
alpha |
probability of type I error |
alternative |
direction or type of the hypothesis test: "not equal", "greater", "less", "non-inferior", "superior", or "equivalent" |
verbose |
if |
Value
parms |
list of parameters used in calculation |
test |
type of the statistical test (z or t test) |
df |
numerator degrees of freedom |
ncp |
non-centrality parameter |
power |
statistical power |
n |
total sample size |
References
Bulus, M. (2021). Sample size determination and optimal design of randomized/non-equivalent pretest-posttest control-group designs. Adiyaman Univesity Journal of Educational Sciences, 11(1), 48-69.
Phillips, K. F. (1990). Power of the two one-Sided tests procedure in bioequivalence. Journal of Pharmacokinetics and Biopharmaceutics, 18(2), 137-144.
Dupont, W. D., and Plummer, W. D. (1998). Power and sample size calculations for studies involving linear regression. Controlled Clinical Trials, 19(6), 589-601.
Examples
# continuous predictor x (and 4 covariates)
pwrss.t.reg(beta1 = 0.20, alpha = 0.05,
alternative = "not equal",
k = 5, r2 = 0.30,
power = 0.80)
pwrss.t.reg(beta1 = 0.20, alpha = 0.05,
alternative = "not equal",
k = 5, r2 = 0.30,
n = 138)
# binary predictor x (and 4 covariates)
p <- 0.50 # proportion of subjects in one group
pwrss.t.reg(beta1 = 0.20, alpha = 0.05,
alternative = "not equal",
sdx = sqrt(p*(1-p)),
k = 5, r2 = 0.30,
power = 0.80)
pwrss.t.reg(beta1 = 0.20, alpha = 0.05,
alternative = "not equal",
sdx = sqrt(p*(1-p)) ,
k = 5, r2 = 0.30,
n = 550)
# non-inferiority test with binary predictor x (and 4 covariates)
p <- 0.50 # proportion of subjects in one group
pwrss.t.reg(beta1 = 0.20, beta0 = 0.10, margin = -0.05,
alpha = 0.05, alternative = "non-inferior",
sdx = sqrt(p*(1-p)),
k = 5, r2 = 0.30,
power = 0.80)
pwrss.t.reg(beta1 = 0.20, beta0 = 0.10, margin = -0.05,
alpha = 0.05, alternative = "non-inferior",
sdx = sqrt(p*(1-p)),
k = 5, r2 = 0.30,
n = 770)
# superiority test with binary predictor x (and 4 covariates)
p <- 0.50 # proportion of subjects in one group
pwrss.t.reg(beta1 = 0.20, beta0 = 0.10, margin = 0.01,
alpha = 0.05, alternative = "superior",
sdx = sqrt(p*(1-p)),
k = 5, r2 = 0.30,
power = 0.80)
pwrss.t.reg(beta1 = 0.20, beta0 = 0.10, margin = 0.01,
alpha = 0.05, alternative = "superior",
sdx = sqrt(p*(1-p)),
k = 5, r2 = 0.30,
n = 2138)
# equivalence test with binary predictor x (and 4 covariates)
p <- 0.50 # proportion of subjects in one group
pwrss.t.reg(beta1 = 0.20, beta0 = 0.20, margin = 0.05,
alpha = 0.05, alternative = "equivalent",
sdx = sqrt(p*(1-p)),
k = 5, r2 = 0.30,
power = 0.80)
pwrss.t.reg(beta1 = 0.20, beta0 = 0.20, margin = 0.05,
alpha = 0.05, alternative = "equivalent",
sdx = sqrt(p*(1-p)),
k = 5, r2 = 0.30,
n = 9592)