Skip to contents

randomizeCRT carries out randomization of clusters and augments the trial data frame with assignments to arms

Usage

randomizeCRT(
  trial,
  matchedPair = FALSE,
  baselineNumerator = "base_num",
  baselineDenominator = "base_denom"
)

Arguments

trial

an object of class "CRTsp" or a data frame containing locations in (x,y) coordinates, cluster assignments (factor cluster), and arm assignments (factor arm). Optionally: specification of a buffer zone (logical buffer); any other variables required for subsequent analysis.

matchedPair

logical: indicator of whether pair-matching on the baseline data should be used in randomization

baselineNumerator

name of numerator variable for baseline data (required for matched-pair randomization)

baselineDenominator

name of denominator variable for baseline data (required for matched-pair randomization)

Value

A list of class "CRTsp" containing the following components:

designlist:parameters required for power calculations
geom_fulllist:summary statistics describing the site
geom_corelist:summary statistics describing the core area (when a buffer is specified)
trialdata frame:rows correspond to geolocated points, as follows:
xnumeric vector: x-coordinates of locations
ynumeric vector: y-coordinates of locations
clusterfactor: assignments to cluster of each location
pairfactor: assigned matched pair of each location (for matchedPair randomisations)
armfactor: assignments to "control" or "intervention" for each location
...other objects included in the input "CRTsp" object or data frame

Examples

# Randomize the clusters in an example trial
exampleCRT <- randomizeCRT(trial = readdata('exampleCRT.txt'), matchedPair = TRUE)
#> *** No baseline data for matching. Unmatched randomisation ***
#> *** computed distance to nearest measurements in discordant arm ***