icc_to_RandEff: Transform ICC, CAC, IAC into random effects

View source: R/helper_functions.R

icc_to_RandEffR Documentation

Transform ICC, CAC, IAC into random effects

Description

This function transforms a covariance structure specified by intracluster correlation (ICC), cluster autocorrelation (CAC) and individual autocorrelation (IAC) as in Hooper et al. (2016) into the random effects notation. The latter specification type is used by the workhorse function of this package, glsPower().

Usage

icc_to_RandEff(icc, cac = 1, iac = 0, sigMarg = NULL, sigResid = NULL)

Arguments

icc

intracluster correlation

cac

cluster autocorrelation

iac

individual autocorrelation

sigMarg

Marginal standard deviation

sigResid

Residual standard deviation on individual level

Details

The formulae used are

\sigma^2_{resid} = \sigma^2_{marg} (1-ICC) (1-IAC) \\[1ex] \tau^2 = \sigma^2_{marg} \cdot ICC \cdot CAC \\[1ex] \gamma^2 = \sigma^2_{marg} \cdot ICC \cdot (1-CAC) \\[1ex] \psi^2 = \sigma^2_{marg} \cdot IAC \cdot (1-ICC)

Note that this does not allow to define the standard deviation of a random treatment effect eta, but you can manually define it in the call to glsPower(), see examples.

The CAC is sometimes interpreted in two different ways. Two-period decay (the more common interpretation) allows correlation within the same period to differ form those across periods. Discrete time decay (much less common interpretation), on the other hand, assumes a consistent rate of correlation decay over time. The former introduces an additional random term (i.e. an cluster-period specific random intercept, with standard deviation \gamma), whereas the latter simply defines a fixed autocorrelation structure that dictates how correlations diminish over time. Therefore, if CAC is specified, is is interpreted as two-period decay and a (non-zero) value for gamma is returned. To define discrete time decay, please use the AR option in the main function glsPower() instead.

Value

a list containing five named elements (possibly vectors or matrices):

  • random cluster intercept tau,

  • random time effect gamma,

  • random subject intercept psi,

  • residual standard deviation sigResid and

  • marginal standard deviation sigMarg.

References

Hooper, R., Teerenstra, S., de Hoop, E., & Eldridge, S. (2016).
Sample size calculation for stepped wedge and other longitudinal cluster randomised trials.
Statistics in medicine, 35(26), 4718-4728. DOI: 10.1002/sim.7028

See Also

RandEff_to_icc(), RandEff_to_alpha012() or alpha012_to_RandEff()

Examples

## The function can be applied to vectors
tmp <- icc_to_RandEff(icc=c(0.01,0.005,0.001),
                      cac=1,
                      iac=.001,
                      sigMarg=sqrt(.5*(1-.5)) )
tmp

## This can then be inserted into `glsPower()` to calculate power for a
## specific setting (albeit not as vectors)
## Possibly with an additional random treatment effect `eta`.
glsPower(Cl=rep(2,4),
         N = 15,
         mu0=.5, mu1=.3,
         sigma = tmp$sigResid[1],
         tau   = tmp$tau[1],
         gamma = tmp$gamma[1],
         psi   = tmp$psi[1],
         eta   = 0.03 )




PMildenb/SteppedPower documentation built on Sept. 19, 2024, 7:22 a.m.