cpa.did.binary: Power calculations for difference-in-difference cluster...

Description Usage Arguments Details Value Authors Note References Examples

View source: R/cpa.did.binary.R

Description

Compute the power of a difference-in-difference cluster randomized trial design with a binary outcome, or determine parameters to obtain a target power.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
cpa.did.binary(
  alpha = 0.05,
  power = 0.8,
  nclusters = NA,
  nsubjects = NA,
  p = NA,
  d = NA,
  ICC = NA,
  rho_c = NA,
  rho_s = NA,
  tol = .Machine$double.eps^0.25
)

Arguments

alpha

The level of significance of the test, the probability of a Type I error.

power

The power of the test, 1 minus the probability of a Type II error.

nclusters

The number of clusters per condition. It must be greater than 1.

nsubjects

The mean of the cluster sizes.

p

The expected mean proportion at the post-test, averaged across both arms.

d

The expected absolute difference.

ICC

The intraclass correlation.

rho_c

The correlation between baseline and post-test outcomes at the cluster level. This value can be used in both cross-sectional and cohort designs. If this quantity is unknown, a value of 0 is a conservative estimate.

rho_s

The correlation between baseline and post-test outcomes at the subject level. This should be used for a cohort design or a mixture of cohort and cross-sectional designs. In a purely cross-sectional design (baseline subjects are completely different from post-test subjects), this value should be 0.

tol

Numerical tolerance used in root finding. The default provides at least four significant digits.

Details

Exactly one of alpha, power, nclusters, nsubjects, p, d, ICC, rho_c, and rho_s must be passed as NA. Note that alpha and power have non-NA defaults, so if those are the parameters of interest they must be explicitly passed as NA.

Value

The computed argument.

Authors

Jonathan Moyer (jon.moyer@gmail.com), Ken Kleinman (ken.kleinman@gmail.com)

Note

This function was inspired by work from Stephane Champely (pwr.t.test) and Peter Dalgaard (power.t.test). As with those functions, 'uniroot' is used to solve power equation for unknowns, so you may see errors from it, notably about inability to bracket the root when invalid arguments are given.

References

Murray D. Design and Analysis of Group-Randomized Trials. New York, NY: Oxford University Press; 1998.

Examples

1
2
3
4
5
6
7
8
# Find the number of clusters per condition needed for a trial with alpha = .05,
# power = 0.8, 50 observations per cluster, expected mean post-test proportion of .50,
# expected difference of .1, ICC = 0.05, cluster level correlation of 0.3, and subject level
# correlation of 0.7.
cpa.did.binary(nsubjects=50 ,p=.5, d=.1, ICC=.05, rho_c=.3, rho_s=.7)
#
# The result, showimg nclusters of greater than 32, suggests 33 clusters per
# condition should be used.

nickreich/clusterPower documentation built on Feb. 3, 2021, 6:54 p.m.