Calculate minimal detectable slope for mediator given sample size and power in poisson regression based on Vittinghoff, Sen and McCulloch's (2009) method.

1 2 3 4 5 6 7 | ```
minEffect.VSMc.poisson(n,
power,
sigma.m,
EY,
corr.xm,
alpha = 0.05,
verbose = TRUE)
``` |

`n` |
sample size. |

`power` |
power for testing |

`sigma.m` |
standard deviation of the mediator. |

`EY` |
the marginal mean of the outcome |

`corr.xm` |
correlation between the predictor |

`alpha` |
type I error rate. |

`verbose` |
logical. |

The test is for testing the null hypothesis *b_2=0*
versus the alternative hypothesis *b_2\neq 0*
for the poisson regressions:

*
\log(E(Y_i))=b_0+b_1 x_i + b_2 m_i
*

Vittinghoff et al. (2009) showed that for the above poisson 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*, if the
correlation `corr.xm`

between the primary predictor and mediator is non-zero.

The full model is

*
\log(E(Y_i))=b_0+b_1 x_i + b_2 m_i
*

The reduced model is

*
\log(E(Y_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.

`b2 ` |
minimum absolute detectable effect. |

`res.uniroot ` |
results of optimization to find the optimal sample size. |

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

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:541-557.

`powerMediation.VSMc.poisson`

,
`ssMediation.VSMc.poisson`

1 2 3 4 5 6 | ```
# example in section 5 (page 546) of Vittinghoff et al. (2009).
# minimum effect is = log(1.35) = 0.3001046
minEffect.VSMc.poisson(n = 1239, power = 0.7998578,
sigma.m = sqrt(0.25 * (1 - 0.25)),
EY = 0.5, corr.xm = 0.5,
alpha = 0.05, verbose = TRUE)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.