Skip to contents

specify_buffer specifies a buffer zone in a cluster randomized trial (CRT) by flagging those locations that are within a defined distance of those in the opposite arm.

Usage

specify_buffer(trial, buffer_width = 0)

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).

buffer_width

minimum distance between locations in opposing arms for them to qualify to be included in the core area (km)

Value

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

geom_fulllist:summary statistics describing the site, cluster assignments, and randomization.
geom_corelist:summary statistics describing the core area
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
armfactor: assignments to "control" or "intervention" for each location
nearestDiscordnumeric vector: signed Euclidean distance to nearest discordant location (km)
bufferlogical: indicator of whether the point is within the buffer
...other objects included in the input "CRTsp" object or data frame

Examples

#Specify a buffer of 200m
exampletrial <- specify_buffer(trial = readdata('exampleCRT.txt'), buffer_width = 0.2)