This function plans sample size with respect to the group-by-time interaction in the context of a longitudinal design with two groups. It plans sample size from the accuracy in parameter estimation (AIPE) perspective, where the goal is to obtain a sufficiently narrow confidence interval for the fixed effect polynomial change coefficient parameter (e.g., linear, quadratic, etc.). The sample size returned can be one such that (a) the expected confidence interval width is sufficiently narrow, or (b) the observed confidence interval will be sufficiently narrow with a specified high degree of assurance (e.g., .99, .95, .90, etc.). This function accompanies Kelley and Rausch (2011).

1 2 3 | ```
ss.aipe.pcm(true.variance.trend, error.variance,
variance.true.minus.estimated.trend = NULL, duration, frequency,
width, conf.level = 0.95, trend = "linear", assurance = NULL)
``` |

`true.variance.trend` |
The variance of the individuals' true change coefficients (i.e., |

`error.variance` |
The true error variance (i.e., |

`variance.true.minus.estimated.trend` |
The variance of the difference between the |

`duration` |
The duration of the study. |

`frequency` |
The number of times measurement occurs within each unit of time. |

`width` |
width of the confidence interval |

`conf.level` |
The desired level of confidence for the confidence interval that will be computed at the completion of the study. |

`trend` |
The polynomial trend (1st-3rd) of interest specified as "linear", "quadratic", or "cubic". |

`assurance` |
Value with which confidence can be placed that describes the likelihood of obtaining a confidence interval less than the value specified (e.g, .80, .90, .95) |

Returns the necessary sample size for the combination of the desired goals and values of the population parameters for a specific design.

Like in all formal sample size planning methods that require the value of one or more population parameter(s), if the population parameters are incorrectly specified, there is no guarantee that the sample size this function returns will be accurate. Of course, the further away from the true values, the further away the true sample size will tend to be.

The number of timepoints in a study (say *M*) is defined by *f \times D + 1*, where *f* is the frequency and *D* is the duration.

Ken Kelley (University of Notre Dame; KKelley@ND.Edu)

Kelley, K., & Rausch, J. R. (2011). Accuracy in parameter estimation for polynomial change models. *Psychological Methods*.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ```
## Not run:
# An example used in Kelley and Rausch for the expected confidence interval
# width (returns 278). Thus, a necessary sample size of 278 is required when
# the duration of the study will be 4 units and the frequency of measurement
# occasions is 1 year in order for the expected confidence interval
# width to be 0.025 units.
ss.aipe.pcm(true.variance.trend=0.003, error.variance=0.0262, duration=4,
frequency=1, width=0.025, conf.level=.95)
# Now, when incorporating an assurance parameter (returns 316).
# Thus, a necessary sample size of 316 will ensure that the 95% confidence
# interval will be sufficiently narrow (i.e., have a width less than .025 units)
# at least 99% of the time.
ss.aipe.pcm(true.variance.trend=.003, error.variance=.0262, duration=4,
frequency=1, width=.025, conf.level=.95, assurance=.99)
## End(Not run)
``` |

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.