getDesignRepeatedANOVA {lrstat}R Documentation

Power and sample size for repeated-measures ANOVA

Description

Obtains the power and sample size for one-way repeated measures analysis of variance. Each subject takes all treatments in the longitudinal study.

Usage

getDesignRepeatedANOVA(
  beta = NA_real_,
  n = NA_real_,
  ngroups = 2,
  means = NA_real_,
  stDev = 1,
  corr = 0,
  rounding = TRUE,
  alpha = 0.05
)

Arguments

beta

The type II error.

n

The total sample size.

ngroups

The number of treatment groups.

means

The treatment group means.

stDev

The total standard deviation.

corr

The correlation among the repeated measures.

rounding

Whether to round up sample size. Defaults to 1 for sample size rounding.

alpha

The two-sided significance level. Defaults to 0.05.

Details

Let yijy_{ij} denote the measurement under treatment condition j(j=1,,k)j (j=1,\ldots,k) for subject i(i=1,,n)i (i=1,\ldots,n). Then

yij=α+βj+bi+eij,y_{ij} = \alpha + \beta_j + b_i + e_{ij},

where bib_i denotes the subject random effect, biN(0,σb2),b_i \sim N(0, \sigma_b^2), and eijN(0,σe2)e_{ij} \sim N(0, \sigma_e^2) denotes the within-subject residual. If we set βk=0\beta_k = 0, then α\alpha is the mean of the last treatment (control), and βj\beta_j is the difference in means between the jjth treatment and the control for j=1,,k1j=1,\ldots,k-1.

The repeated measures have a compound symmetry covariance structure. Let σ2=σb2+σe2\sigma^2 = \sigma_b^2 + \sigma_e^2, and ρ=σb2σb2+σe2\rho = \frac{\sigma_b^2}{\sigma_b^2 + \sigma_e^2}. Then Var(yi)=σ2{(1ρ)Ik+ρ1k1kT}Var(y_i) = \sigma^2 \{(1-\rho) I_k + \rho 1_k 1_k^T\}. Let XiX_i denote the design matrix for subject ii. Let θ=(α,β1,,βk1)T\theta = (\alpha, \beta_1, \ldots, \beta_{k-1})^T. It follows that

Var(θ^)=(i=1nXiTVi1Xi)1.Var(\hat{\theta}) = \left(\sum_{i=1}^{n} X_i^T V_i^{-1} X_i\right)^{-1}.

It can be shown that

Var(β^)=σ2(1ρ)n(Ik1+1k11k1T).Var(\hat{\beta}) = \frac{\sigma^2 (1-\rho)}{n} (I_{k-1} + 1_{k-1} 1_{k-1}^T).

It follows that β^TV^β^1β^Fk1,(n1)(k1),λ,\hat{\beta}^T \hat{V}_{\hat{\beta}}^{-1} \hat{\beta} \sim F_{k-1,(n-1)(k-1), \lambda}, where the noncentrality parameter for the FF distribution is

λ=βTVβ^1β=nj=1k(μjμˉ)2σ2(1ρ).\lambda = \beta^T V_{\hat{\beta}}^{-1} \beta = \frac{n \sum_{j=1}^{k} (\mu_j - \bar{\mu})^2}{\sigma^2(1-\rho)}.

Value

An S3 class designRepeatedANOVA object with the following components:

Author(s)

Kaifeng Lu, kaifenglu@gmail.com

Examples


(design1 <- getDesignRepeatedANOVA(
  beta = 0.1, ngroups = 4, means = c(1.5, 2.5, 2, 0),
  stDev = 5, corr = 0.2, alpha = 0.05))


[Package lrstat version 0.2.9 Index]