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.

Value

power

power for testing if b_2=0.

delta

b_2σ_m√{(1-ρ_{xm}^2) p (1-p)}

, 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.

Note

The test is a two-sided test. Code for one-sided tests will be added later.