Description Usage Arguments Details Value Note Author(s) References See Also Examples
View source: R/power_VSMc_logistic.R
Calculate Power for testing mediation effect in logistic regression based on Vittinghoff, Sen and McCulloch's (2009) method.
1 2 3 4 5 6 7  powerMediation.VSMc.logistic(n,
b2,
sigma.m,
p,
corr.xm,
alpha = 0.05,
verbose = TRUE)

n 
sample size. 
b2 
regression coefficient for the mediator m in the logistic regression \log(p_i/(1p_i))=b0+b1 x_i + b2 m_i. 
sigma.m 
standard deviation of the mediator. 
p 
the marginal prevalence of the outcome. 
corr.xm 
correlation between the predictor x and the mediator m. 
alpha 
type I error rate. 
verbose 
logical. 
The power is for testing the null hypothesis b_2=0 versus the alternative hypothesis b_2\neq 0 for the logistic regressions:
\log(p_i/(1p_i))=b0+b1 x_i + b2 m_i
Vittinghoff et al. (2009) showed that for the above logistic regression, testing the mediation effect is equivalent to testing the null hypothesis H_0: b_2=0 versus the alternative hypothesis H_a: b_2\neq 0.
The full model is
\log(p_i/(1p_i))=b_0+b_1 x_i + b_2 m_i
The reduced model is
\log(p_i/(1p_i))=b_0+b_1 x_i
Vittinghoff et al. (2009) mentioned that if confounders need to be included
in both the full and reduced models, the sample size/power calculation formula
could be accommodated by redefining corr.xm
as the multiple
correlation of the mediator with the confounders as well as the predictor.
power 
power for testing if b_2=0. 
delta 
b_2σ_m√{(1ρ_{xm}^2) p (1p)} 
, where σ_m is the standard deviation of the mediator m, ρ_{xm} is the correlation between the predictor x and the mediator m, and p is the marginal prevalence of the outcome.
The test is a twosided test. For onesided tests, please double the
significance level. For example, you can set alpha=0.10
to obtain onesided test at 5% significance level.
Weiliang Qiu stwxq@channing.harvard.edu
Vittinghoff, E. and Sen, S. and McCulloch, C.E.. Sample size calculations for evaluating mediation. Statistics In Medicine. 2009;28:541557.
minEffect.VSMc.logistic
,
ssMediation.VSMc.logistic
1 2 3 4  # example in section 4 (page 545) of Vittinghoff et al. (2009).
# power = 0.8005793
powerMediation.VSMc.logistic(n = 255, b2 = log(1.5), sigma.m = 1,
p = 0.5, corr.xm = 0.5, alpha = 0.05, verbose = TRUE)

[1] 0.8005793
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.