Learn R Programming

sjstats (version 0.18.2)

samplesize_mixed: Sample size for linear mixed models

Description

Compute an approximated sample size for linear mixed models (two-level-designs), based on power-calculation for standard design and adjusted for design effect for 2-level-designs.

Usage

samplesize_mixed(
  eff.size,
  df.n = NULL,
  power = 0.8,
  sig.level = 0.05,
  k,
  n,
  icc = 0.05
)

smpsize_lmm( eff.size, df.n = NULL, power = 0.8, sig.level = 0.05, k, n, icc = 0.05 )

Value

A list with two values: The number of subjects per cluster, and the total sample size for the linear mixed model.

Arguments

eff.size

Effect size.

df.n

Optional argument for the degrees of freedom for numerator. See 'Details'.

power

Power of test (1 minus Type II error probability).

sig.level

Significance level (Type I error probability).

k

Number of cluster groups (level-2-unit) in multilevel-design.

n

Optional, number of observations per cluster groups (level-2-unit) in multilevel-design.

icc

Expected intraclass correlation coefficient for multilevel-model.

Details

The sample size calculation is based on a power-calculation for the standard design. If df.n is not specified, a power-calculation for an unpaired two-sample t-test will be computed (using pwr.t.test of the pwr-package). If df.n is given, a power-calculation for general linear models will be computed (using pwr.f2.test of the pwr-package). The sample size of the standard design is then adjusted for the design effect of two-level-designs (see design_effect). Thus, the sample size calculation is appropriate in particular for two-level-designs (see Snijders 2005). Models that additionally include repeated measures (three-level-designs) may work as well, however, the computed sample size may be less accurate.

References

Cohen J. 1988. Statistical power analysis for the behavioral sciences (2nd ed.). Hillsdale,NJ: Lawrence Erlbaum.

Hsieh FY, Lavori PW, Cohen HJ, Feussner JR. 2003. An Overview of Variance Inflation Factors for Sample-Size Calculation. Evaluation and the Health Professions 26: 239-257.

Snijders TAB. 2005. Power and Sample Size in Multilevel Linear Models. In: Everitt BS, Howell DC (Hrsg.). Encyclopedia of Statistics in Behavioral Science. Chichester, UK: John Wiley and Sons, Ltd.

Examples

Run this code
# Sample size for multilevel model with 30 cluster groups and a small to
# medium effect size (Cohen's d) of 0.3. 27 subjects per cluster and
# hence a total sample size of about 802 observations is needed.
samplesize_mixed(eff.size = .3, k = 30)

# Sample size for multilevel model with 20 cluster groups and a medium
# to large effect size for linear models of 0.2. Five subjects per cluster and
# hence a total sample size of about 107 observations is needed.
samplesize_mixed(eff.size = .2, df.n = 5, k = 20, power = .9)

Run the code above in your browser using DataLab