R/design_sw.R
design_sw.Rddesign_sw builds a binary treatment indicator
matrix for a specified conventional (i.e., two treatment
conditions, say control and experimental interventions) stepped-wedge cluster
randomised trial (SW-CRT) design, for subsequent use with
draw_sw.
design_sw(clusters_per_time_period = c(0, 1, 1, 1, 1), labels = c("0", "1"), row_names = 1:sum(clusters_per_time_period), col_names = 1:length(clusters_per_time_period))
| clusters_per_time_period | A |
|---|---|
| labels | A |
| row_names | A |
| col_names | A |
Returns the binary treatment indicator matrix, in
matrix form, for the implied SW-CRT design. This can be passed
to draw_sw.
Michael J Grayling (michael.grayling@newcastle.ac.uk)
# The default is a 'standard' SW-CRT design, with four clusters and five time # periods default_design <- design_sw() # Specify a more complex design, where all clusters begin in the intervention # condition, there is an unequal number of clusters who switch per time # period, and there are two trailing extra time periods with all clusters in # the intervention condition. Also modify the row and column names complex_design <- design_sw(clusters_per_time_period = c(1, 2, 3, 2, 0, 0), row_names = paste("Cluster", 1:8), col_names = paste("Time period", 1:6))