Learn R Programming

swCRTdesign (version 2.1)

swDsn: Study design of Stepped Wedge Cluster Randomized Trial (SW CRT)

Description

swDsn returns a SW CRT study design object based on a repeated cross-sectional sampling scheme. All clusters that start the intervention at a given time point are collectively referred to as a wave. There many be a variable number of clusters in each wave. By default, all clusters are assumed to start in the control condition. Fractional treatment effect may be specified for each time after the intervention is introduced. Additional observations may be added to the end of the trial after the intervention has been introduced in all clusters. swDsn is used by other functions in this package.

Usage

swDsn(clusters, tx.effect = 1, extra.time = 0, all.ctl.time0 = TRUE)

Arguments

clusters
integer (vector): Number of clusters for each wave (e.g. c(6,6,6,6) specifies four waves with 6 clusters in each wave). A value of 0 in the vector means that no clusters introduce the intervention at a given time (see examples).
tx.effect
numeric (scalar or vector): Fractional treatment effect upon crossing over from control. If a scalar with value of 1, the standard SW CRT treatment effect will be presumed. If a scalar with a fractional value between 0 and 1, then only the first time point upon crossing over from control will have fractional treatment effect; the remaining time points in SW CRT design will have value of 1. If a vector of fractional treatment effect is specified, each element of the vector corresponds to the (fractional) treatment effect upon crossing over from control; if length of vector less than total number of time points after crossing over, the remaining time points will have treatment effect value of 1; if length of vector greater than total number of time points after crossing over, not all elements of vector will be used. The default value is (scalar) 1.
extra.time
integer (scalar): Number of additional time steps beyond the standard SW CRT design (standard + extended times corresponds to total time). The default value is 0.
all.ctl.time0
logical: If TRUE, all clusters receive control at time 0. If FALSE, clusters in the first wave (i.e., the first element of clusters) receive intervention at time 0. The default is TRUE.

Value

numeric (list): Returns the following user-specified and computed objects

References

Hussey MA, Hughes JP. Design and analysis of stepped wedge cluster randomized trials. Contemporary Clinical Trials 2007;28:182-191.

Examples

Run this code
library(swCRTdesign)
# Example 1 (Equal clusters per wave, standard SW design)
swDsn.Ex1.std <- swDsn( clusters=c(3,3,3) )
swDsn.Ex1.std$swDsn

# Example 2 (Equal clusters per wave, extended SW design)
swDsn.Ex1.extend <- swDsn( clusters=c(3,3,3), extra.time=2 )
swDsn.Ex1.extend$swDsn

# Example 3 (Equal clusters per wave, not all ctl at time 0, "standard" for time SW design)
swDsn.Ex1.std.noAllctl <- swDsn( clusters=c(3,3,3), all.ctl.time0=FALSE )
swDsn.Ex1.std.noAllctl$swDsn

# Example 4 (Equal clusters per wave, not all ctl at time 0, extended SW design)
swDsn.Ex1.extend.noAllctl <- swDsn( clusters=c(3,3,3), extra.time=2, all.ctl.time0=FALSE )
swDsn.Ex1.extend.noAllctl$swDsn

# Example 5 (Unequal clusters per wave, standard SW design)
swDsn.Ex1.std.unequal <- swDsn( clusters=c(3,0,2) )
swDsn.Ex1.std.unequal$swDsn

# Example 6 (Unequal clusters per wave, extended SW design)
swDsn.Ex1.extend.unequal <- swDsn( clusters=c(3,0,2), extra.time=2 )
swDsn.Ex1.extend.unequal$swDsn

# Example 7 (Unequal clusters per wave, extended SW design)
swDsn.Ex1.extend.unequal.varyTxEffect <- swDsn( clusters=c(3,0,2), tx.effect=c(0.8,0.9,1.0), 
extra.time=2 )
swDsn.Ex1.extend.unequal.varyTxEffect$swDsn

Run the code above in your browser using DataLab