help for clustersampsim

Title

clustersampsim -- simulates cluster-randomized trial sample size requirements for a given range of numbers of clusters or cluster sizes for up to two sets of assumptions

Syntax

clustersampsim, {clusters(numlist) | clustersizes(numlist)}
{mdes(effect_size) rho(icc)} base_correl(corr) alpha(sig_level)
beta(power) savesims(filename) noplot mdes2(effect_size)
rho2(icc) base_correl2(corr) alpha2(sig_level) beta2(power)

Where numlist is a list of desired numbers of clusters or average cluster sizes to simulate.

options

Required options:

One of these options must be used:

clusters(numlist) Simulate the required number sample per cluster for a list of numbers of clusters (per arm)

clustersizes(numlist) Simulate the required number of clusters (per arm) for a list of cluster sizes

All of these options must be specified:

mdes(effect_size) Desired minimum detectable effect size for the simulation

rho(icc) Intra-class correlation in outcome measure

Optional options

Graphing and output options:

noplot Suppress graphical output of simulations. If this option is chosen, savesims(filename) must be specified.

savesims(filename) Save results of the simulation to a Stata .dta file.

Additional parameter specifications:

base_correl(corr) Baseline-endline correlation. Default is 0.

alpha(sig_level) Significance level. Default is .05.

beta(power) Level of statistical power. Default is .8.

Optional second set of assumptions:

mdes2(effect_size) Desired minimum detectable effect size for second set of simulations.

rho2(icc) Intra-class correlation in outcome measure for second set of simulations.

base_correl2(corr) Baseline-endline correlation for second set of simulations.

alpha2(sig_level) Significance level for second set of simulations.

beta2(power) Level of statistical power for second set of simulations.

Description

clustersampsim is an extension of the clustersampsi command that allows the user to specify either 1) a range of numbers of clusters per study arm to find the required sample sizes per cluster 2) a range of cluster sizes to find the numbers of required clusters per study arm. In addition to providing either clusters(numlist) or clustersizes(numlist), the user must specify, at a minimum, mdes(effect_size), the minimum detectable effect size for the simulation and rho(icc), the intra-class correlation. In addition, the user may specify the amount of variance at endline explained by baseline with base_correl(corr), the significance level with alpha(sig_level), and the statistical power desired with beta(power).

By default, the command will produce a plot of the simulations. In addition, the resulting simulations can be saved to a Stata .dta by specifying the savesims(filename) option. The noplot option supppresses the graphical output. If noplot is applied, savesims(filename) must also be applied.

Up to two sets of assumptions are supported by the program. If any of the options mdes2(effect_size), rho2(icc), base_correl2(corr), alpha2(sig_level), or beta2(power) are specified, the program will automatically produce two sets of simulations. Only one "2" option is required to produce the second set of simulations. Unless otherwise specified, the second set of simulations will take on the specified values for the first set of assumptions.

Examples

Example 1.

clustersampsim, clusters(30/60) mdes(.3) rho(.1)

In Example 1, we want to have a cluster-RCT to detect and effect size of .3 given an ICC of .1. We want to consider how large each sample per cluster should be for the range of 30-60 clusters. In the resulting graph, we can see that with 30 clusters per arm, we will have to sample 14 units per cluster. Conversely, with 60 clusters, we can get away with only 4 sampled units per cluster.

Example 2.

clustersampsim, clustersizes(5/15) mdes(.3) rho(.1)

Example 2 is the counterpoint to Example 1. Here, we want to see how many clusters per arm we require if we sample 5-15 units per cluster. The resulting graph shows us that we require 50 clusters per arm if we sample 5 units per cluster, and fewer than 30 clusters per arm if we sample 15.

Example 3.

clustersampsim, clusters(5/15) mdes(.3) rho(.1)

Example 3 will generate an error because there are no solutions to detect an effect size of .3 and an ICC of .1 with 15 or fewer clusters. To fix this error, we must either increase our allowable numbers per cluster, increase the MDES, or decrease the ICC.

Example 4.

clustersampsim, clusters(30/60) mdes(.3) rho(.1) mdes2(.25)

Example 4 introduces a double simulation. Here we simulate both for an MDES of .3 and .25. Note that only parameters appended with "2" are different in the second simulation. All other parameters will be inherited from the primary simulatino. In the resulting graph, we can see that the small-cluster solutions have huge differences between the required sample per cluster, but as the cluster number growth, difference become much smaller.

Example 5.

clustersampsim, clusters(30/60) mdes(.3) rho(.1) alpha(.1) beta(.9) mdes2(.25) rho2(.08)

Example 5 builds on Example 4, but also specifies that the ICC for the second simulation is smaller.

Example 6.

clustersampsim, clusters(30/60) mdes(.3) rho(.1) alpha(.1) beta(.9) mdes2(.25) rho2(.08) savesims(simulation_results) noplot

Example 6 builds on Example 5, but suppresses the graphical output, and saves the results of the simulations to simulation_results.dta.

Acknowledgements

This command is based entirely on clustersampsi developed by Karla Hemming and Jen Marsh. Thank you to the following for testing and feedback (in alphabetic order):

Kabira Namit

Author

Jonathan Seiden
Harvard Graduate School of Education
jseiden@g.harvard.edu

I appreciate comments, feedback, and bug reports made by email or through my GitHub repository.