*! version 1.1.0 15Apr2022

help power swgee

Title

power swgee -- Computes power (under both a Z and t distribution) for cluster randomized stepped wedge designs assuming analysis is performed using a generalized estimating equations (GEE) model

Syntax

power swgee, es(real) nclusters(integer) nperiods(integer) n(integer) [other options power_options]

Required
es(real) Specifies the effect size. Note that this is not the standardized effect size but the effect size on the scale of the outcome. Specifically, specify a difference for identity link,
an odds ratio for logit link and a risk or rate ratio for log link (for binary or count outcomes, respectively).

nclusters(integer) Specifies the number of clusters in the stepped wedge design. Note that if only the
required options are specified, then the number of clusters must be a multiple of nperiods-1

nperiods(integer) Number of time periods in the study

n(integer) Number of individuals in each cluster at each time period. Depednign on the design
(cross sectional or cohort) these may be the same individuals within the same cluster in different time periods, or
these may be different people in each cluster in each time period

If only the required options are specified, a complete design is assumed and all clusters start in the control condition
so that the number of steps is nperiods-1.

Optional
mu0(numlist) Mean/probability/rate of outcome in control at baseline (time period 0). Must specify a
probability/rate between 0 and 1 (but not including 0 or 1), which is then converted to the link function scale. Defaults
to 0.1.

muT(numlist) Mean/probability/rate of outcome in control at final time period (time T), even if no
clusters are in the control condition at the final time period. Must specify a probability/rate between 0 and 1 (but not
including 0 or 1), which is then converted to the link function scale. Defaults to be equal to mu0. See description
section for more details on period effects.

mus(numlist) A list of numbers indicating the control outcome probabilities/rates across
time (the time trend). If not supplied, then defaults to period effects being specified by mu0 and muT.
Otherwise, if mus is specified, mu0 and muT will be overridden if they are also specified.

design(varlist) The design option allows the user to insert a list of variables corresponding
to the design, where those variables are from a data set that is currently loaded in Stata.

alpha(real) Two-tailed type I error rate; defaults to 0.05

working_ind(integer) Specifes whether to use the robust sandwich variance assuming
working independence (1) or the model based variance where the working correlation corresponds to the true correlation structure (0) to estimate standard errors of the mean model parameters. The default is the
model based variance where the working correlation corresponds to the true correlation structure (0).

corstr(string) Gives the structure of the true correlation matrix, which is also the
working correlation matrix if working_ind=0. The following options are available
for corstr in the context of SW-CRTs. The default is nested exchangeable. Note that the underline in the table indicates
that the option can be specified more succinctly with only the first word of each structure. For example, nested exchangeable
can be specified by only including the word "nested" in the option.

corstr options

Option Design Type Correlation Parameters

nested exchangeable Cross-sectional tau0, tau1
block exchangeable Cohort tau0, tau1, tau2
exponential decay Cross-sectional tau0, rho1
proportional decay Cohort tau0, rho1, rho2

family(string) Specifies the distribution family; default is gaussian, which can also be specified as normal.

link(string) Specifies the link function. The default is logit for binomial family; log for Poisson family; and identity for Gaussian family. The following options are available for family and link.

Family Link

binomial logit
binomial log
binomial identity
poisson log
poisson identity
gaussian log
gaussian identity

phi(real) Dispersion parameter; defaults to 1

df(real) Degrees of freedom for the t-test; defaults to nclusters - 2

tau0(real) Within-period ICC (required for all four correlation structures); must be specified by user

tau1(real) Constant between-period ICC (for nested and block exchangeable correlation structures); defaults to be equal to tau0

tau2(real) Constant repeated-measures ICC (for block exchangeable correlation structure); defaults to be equal to tau1

rho1(real) Between-period ICC decay parameter (for exponential and proportional decay correlation structures); defaults to be equal to 1, indicating no decay

rho2(real) Repeated-measures ICC decay parameter (for proportional decay correlation structure); defaults to be equal to rho1

power_options indicates that other options are passed to the power command. For example, the option table requests an output table, and graph() can be used to specify parameters to graph.
However, certain options, such as onesided, have no effect on this custom power program.

Description

power swgee computes power calculations for stepped wedge designs in the generalized estimating equations (GEE) framework. The theory and background behind the methods are published in Li et al. (2018) and Li (2020). Further description can be found in an article currently under review at Stata Journal. The submitted article can be downloaded here.

Options

If the design option is not specified, then the design defaults to a complete design defined by nclusters and nperiods. For example, if nclusters=5 and nperiods=6, then there are 5 steps
with 1 cluster per step (because all clusters are assumed to start in the control condition and end in the treatment condition and an equal number of clusters is assumed in each step). The design is given by:

1 2 3 4 5 6
+
+
1 | 0 1 1 1 1 1 |
2 | 0 0 1 1 1 1 |
3 | 0 0 0 1 1 1 |
4 | 0 0 0 0 1 1 |
5 | 0 0 0 0 0 1 |
+
+

Period effects are specified using either the mu0 and muT options, or the mus option. The mu0 and muT options are used by default, and will be overridden if the mus option is specified.

If using the mu0 and muT options, you specify the prevalence/rate of outcome in control at baseline and final time period. (Note that for continuous outcomes with identity link, these will
be undefined. If you enter values anyway, they are ignored in the calculation.) (If muT is not specified, it will default to be equal to mu0, which is equivalent to stating that there is no time
trend in the outcome.) Then the program will create a linear trend on the link function scale based on these prevalences/rates and the number of time periods. For example, suppose you specify 0.1 as mu0 and 0.2 as muT,
with four time periods and using a log link. First, the program will convert the endpoints on the link function scale (log(0.1)=-2.30 and log(0.2)=-1.61), then create period effects for the other two time periods in equally spaced
intervals between these two periods (in this case, -2.07 and -1.84).

For researchers who want even more fine-tuned control, the mus option will allow you to enter a set of probabilities/rates equal to the number of periods, which will then be
converted to the link function scale for the power function.

Examples

Create dataset corresponding to the design

. clear

. qui set obs 15

. forvalues i=1/4 {

. gen var`i'=0

. }

. replace var4 = 1

. replace var3 = 1 in 1/10

. replace var2 = 1 in 1/5

Run power command with proportional decay correlation structure, varying tau0

. power swgee, mu0(0.1) muT(0.2) es(2) design(var1-var4) nclust(15) nper(4) n(100) family(poisson) link(log)
corstr(proportional decay) tau0(0.04(0.01)0.06) rho1(0.02) rho2(0.7) alpha(0.05) table graph(xdimension(tau0)
ydimension(t_power))

(click to run)

Example without design matrix

. clear

. power swgee, mu0(0.1) muT(0.2) es(2) nclust(15) nper(4) n(100) family(binomial) link(logit)
corstr(exponential decay) tau0(0.04(0.01)0.06) rho1(0.02) alpha(0.05) table graph(xdimension(tau0) ydimension(t_power))

(click to run)

Stored results

power swgee stores the following in r():

Scalars

r(onesided) 1 for a one-sided test, 0 otherwise; defunct; not used in the program

r(N) number of individuals; defunct; not used in the program

r(separator) number of lines between separator lines in the table

r(divider) 1 if divider is requested in the table, 0 otherwise

r(alpha) significance level (type I error); defunct; not used in the program, see r(size)

r(beta) probability of a type II error defunct; not used in the program

r(power) power defunct; not used in the program; see power_t and power_z in the output table.

r(working_ind) 1 if working_ind option set to 1; 0 otherwise

Other items in the return scalars are for the last iteration of the power program (last row of the output table). All
items for all iterations can be extracted from the table matrix (r(pss_table)).

Macros

r(corstr) Correlation structure chosen

r(family) Distributional family chosen

r(link) Link function chosen

Other macros are common to the power command. See power for more information.

Matrices

r(pss_table) table of results

r(design) design matrix; if user-entered and varied, this is the design matrix of the last iteration of the program
(i.e., the last row in the table)

r(mus) Matrix of probabilities/rates entered in the mus option or the mu0 and muT option;
will be missing if outcome is continuous

r(betas) Matrix of period effects on the link function scale

References

Li, F., Forbes, A. B., Turner, E. L., & Preisser, J.S. (2018). Sample size determination for GEE analyses of stepped wedge cluster randomized trials. Biometrics, 74(4), 1450-1458.

Li, F. (2020). Design and analysis considerations for cohort stepped wedge cluster randomized trials with a decay correlation structure. Statistics in Medicine, 39(4), 438-455.

Authors

John A. Gallis
Duke University Department of Biostatistics and Bioinformatics
Duke Global Health Institute
Durham, NC
john.gallis@duke.edu

Xueqi Wang
Duke University Department of Biostatistics and Bioinformatics
Duke Global Health Institute
Durham, NC
xueqi.wang@duke.edu

Paul J. Rathouz
Department of Population Health
University of Texas at Austin
Dell Medical School
Austin, TX
paul.rathouz@austin.utexas.edu

John S. Preisser
Department of Biosttistics
University of North Carolina at Chapel Hill
Gillings School of Global Public Health
Chapel Hill, NC
jpreisse@bios.unc.edu

Fan Li
Yale School of Public Health
Center for Methods in Implementation and Prevention Science
New Haven, CT
fan.f.li@yale.edu

Elizabeth L. Turner
Duke University Department of Biostatistics and Bioinformatics
Duke Global Health Institute
Durham, NC
liz.turner@duke.edu

Acknowledgements

The authors would like to thank Alyssa Platt of the Duke Global Health Institute Research Design and Analysis Core for testing and providing feedback on the programs.