Description Usage Arguments Details Value Note Author(s) References See Also Examples

Power calculation for testing if mean changes for 2 groups are the same or not for longitudinal study with more than 2 time points.

1 | ```
powerLong.multiTime(es, m, nn, sx2, rho = 0.5, alpha = 0.05)
``` |

`es` |
effect size |

`m` |
number of subjects |

`nn` |
number of observations per subject |

`sx2` |
within subject variance |

`rho` |
within subject correlation |

`alpha` |
type I error rate |

We are interested in comparing the slopes of the 2 groups *A* and *B*:

*
β_{1A} = β_{1B}
*

where

*
Y_{ijA}=β_{0A}+β_{1A} x_{jA} + ε_{ijA}, j=1, …, nn; i=1, …, m
*

and

*
Y_{ijB}=β_{0B}+β_{1B} x_{jB} + ε_{ijB}, j=1, …, nn; i=1, …, m
*

The power calculation formula is (Equation on page 30 of Diggle et al. (1994)):

*
power=Φ≤ft[
-z_{1-α} + √{\frac{m nn s_x^2 es^2}{2(1-ρ)}}
\right]
*

where *es=d/σ*, *d* is the meaninful differnce of interest,
*sigma^2* is the variance of the random error,
*ρ* is the within-subject correlation, and
*s_x^2* is the within-subject variance.

power

The test is a two-sided test. For one-sided tests, please double the
significance level. For example, you can set `alpha=0.10`

to obtain one-sided test at 5% significance level.

Weiliang Qiu stwxq@channing.harvard.edu

Diggle PJ, Liang KY, and Zeger SL (1994). Analysis of Longitundinal Data. page 30. Clarendon Press, Oxford

1 2 | ```
# power=0.8
powerLong.multiTime(es=0.5/10, m=196, nn=3, sx2=4.22, rho = 0.5, alpha = 0.05)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.