Description Usage Arguments Value References Examples

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 contral arm (Liu, 2013). The data from CRT can be analyzed in a two-level hierachical linear model, where the indicator variable for treatment assignment is included in second level. If a study contains multiple treatments, then mutiple indicators will be used. This function is for designs with 2 arms (i.e., a treatment and a control). Details leading to power calculation can be found in Raudenbush (1997) and Liu (2013).

1 2 |

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

`f` |
Effect size. It specifies either the main effect of treatment, or 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 ( |

An object of the power analysis.

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.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | ```
#To calculate the statistical power given sample size and effect size:
wp.crt2arm(f = 0.6, n = 20, J = 10, icc = 0.1, alpha = 0.05, power = NULL)
# Cluster randomized trials with 2 arms
#
# J n f icc power alpha
# 10 20 0.6 0.1 0.5901684 0.05
#
# NOTE: n is the number of subjects per cluster.
# URL: http://psychstat.org/crt2arm
#To generate a power curve given a sequence of sample sizes:
res <- wp.crt2arm(f = 0.6, n = seq(20,100,10), J = 10,
icc = 0.1, alpha = 0.05, power = NULL)
res
# Cluster randomized trials with 2 arms
#
# J n f icc power alpha
# 10 20 0.6 0.1 0.5901684 0.05
# 10 30 0.6 0.1 0.6365313 0.05
# 10 40 0.6 0.1 0.6620030 0.05
# 10 50 0.6 0.1 0.6780525 0.05
# 10 60 0.6 0.1 0.6890755 0.05
# 10 70 0.6 0.1 0.6971076 0.05
# 10 80 0.6 0.1 0.7032181 0.05
# 10 90 0.6 0.1 0.7080217 0.05
# 10 100 0.6 0.1 0.7118967 0.05
#
# NOTE: n is the number of subjects per cluster.
# URL: http://psychstat.org/crt2arm
#To plot the power curve:
plot(res)
#To calculate the required sample size given power and effect size:
wp.crt2arm(f = 0.8, n = NULL, J = 10,
icc = 0.1, alpha = 0.05, power = 0.8)
# Cluster randomized trials with 2 arms
#
# J n f icc power alpha
# 10 16.02558 0.8 0.1 0.8 0.05
#
# NOTE: n is the number of subjects per cluster.
# URL: http://psychstat.org/crt2arm
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.