wp.crt3arm: Statistical Power Analysis for Cluster Randomized Trials with...

View source: R/webpower.R

wp.crt3armR Documentation

Statistical Power Analysis for Cluster Randomized Trials with 3 Arms

Description

Cluster randomized trials (CRT) are a type of multilevel design for the situation when the entire cluster is randomly assigned to either a treatment arm or a control arm (Liu, 2013). The data from CRT can be analyzed in a two-level hierarchical linear model, where the indicator variable for treatment assignment is included in second level. If a study contains multiple treatments, then multiple indicators will be used. This function is for designs with 3 arms (i.e., two treatments and a control). Details leading to power calculation can be found in Raudenbush (1997) and Liu (2013).

Usage

wp.crt3arm(n = NULL, f = NULL, J = NULL, icc = NULL, power = NULL,
  alpha = 0.05, alternative = c("two.sided", "one.sided"),
  type = c("main", "treatment", "omnibus"), interval = NULL)

Arguments

n

Sample size. It is the number of individuals within each cluster.

f

Effect size. It specifies one of the three types of effects: the main effect of treatment, the mean difference between the treatment clusters, and the control clusters.

J

Number of clusters / sides. It tells how many clusters are considered in the study design. At least two clusters are required.

icc

Intra-class correlation. ICC is calculated as the ratio of between-cluster variance to the total variance. It quantifies the degree to which two randomly drawn observations within a cluster are correlated.

power

Statistical power.

alpha

significance level chosed for the test. It equals 0.05 by default.

alternative

Type of the alternative hypothesis ("two.sided" or "one.sided"). The default is "two.sided". The option "one.sided" can be either "less" or "greater".

type

Type of effect ("main" or "treatment" or "omnibus") with "main" as default. The type "main" tests the difference between the average treatment arms and the control arm; Type "treatment" tests the difference between the two treatment arms; and Type "omnibus" tests whether the tree arms are all equivalent.

interval

A vector containing the end-points of the interval to be searched for the root.

Value

An object of the power analysis.

References

Liu, X. S. (2013). Statistical power analysis for the social and behavioral sciences: basic and advanced techniques. Routledge.

Raudenbush, S. W. (1997). Statistical analysis and optimal design for cluster randomized trials. Psychological Methods, 2(2), 173.

Zhang, Z., & Yuan, K.-H. (2018). Practical Statistical Power Analysis Using Webpower and R (Eds). Granger, IN: ISDSA Press.

Examples

#To calculate the statistical power given sample size and effect size:
wp.crt3arm(f = 0.5, n = 20, J = 10, icc = 0.1, alpha = 0.05, power = NULL)
#  Cluster randomized trials with 3 arms
#
#     J  n   f icc     power alpha
#    10 20 0.5 0.1 0.3940027  0.05
#
#  NOTE: n is the number of subjects per cluster.
#  URL: http://psychstat.org/crt3arm

#To generate a power curve given a sequence of sample sizes:
res <- wp.crt3arm(f = 0.5, n = seq(20, 100, 10), J = 10,
                       icc = 0.1, alpha = 0.05, power = NULL)
res
#  Cluster randomized trials with 3 arms
#
#     J   n   f icc     power alpha
#    10  20 0.5 0.1 0.3940027  0.05
#    10  30 0.5 0.1 0.4304055  0.05
#    10  40 0.5 0.1 0.4513376  0.05
#    10  50 0.5 0.1 0.4649131  0.05
#    10  60 0.5 0.1 0.4744248  0.05
#    10  70 0.5 0.1 0.4814577  0.05
#    10  80 0.5 0.1 0.4868682  0.05
#    10  90 0.5 0.1 0.4911592  0.05
#    10 100 0.5 0.1 0.4946454  0.05
#
#  NOTE: n is the number of subjects per cluster.
#  URL: http://psychstat.org/crt3arm

#To plot the power curve:
plot(res)

#To calculate the required sample size given power and effect size:
wp.crt3arm(f = 0.8, n = NULL, J = 10, icc = 0.1, alpha = 0.05, power = 0.8)
#  Cluster randomized trials with 3 arms
#
#     J        n   f icc power alpha
#    10 27.25145 0.8 0.1   0.8  0.05
#
#  NOTE: n is the number of subjects per cluster.
#  URL: http://psychstat.org/crt3arm

WebPower documentation built on Oct. 14, 2023, 1:06 a.m.