powerMediation.VSMc.cox(n,
b2,
sigma.m,
psi,
corr.xm,
alpha = 0.05,
verbose = TRUE)TRUE means printing power; FALSE means not printing power.Vittinghoff et al. (2009) showed that for the above cox 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(\lambda)=\log(\lambda_0)+b_1 x_i + b_2 m_i$$
The reduced model is $$\log(\lambda)=\log(\lambda_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.
minEffect.VSMc.cox,
ssMediation.VSMc.cox# example in section 6 (page 547) of Vittinghoff et al. (2009).
# power = 0.7999916
powerMediation.VSMc.cox(n = 1399, b2 = log(1.5),
sigma.m = sqrt(0.25 * (1 - 0.25)), psi = 0.2, corr.xm = 0.3,
alpha = 0.05, verbose = TRUE)Run the code above in your browser using DataLab