Learn R Programming

CRTspat

CRTspat is an R-package to provide easily accessible R functions for design and analysis of cluster randomized trials (CRTs), where geographically structured spillover is anticipated and where geolocations are available. It includes functions for analysing baseline data, for defining clusters by algorithm, for power and sample size calculation, and for analysis of trial outcomes. It is designed to function with outcomes that are proportions, count data, or continuous variables.

The package was developed with CRTs of malaria interventions in mind, where the spillover is assumed to arise as a result of mosquito movement, with mosquito dispersal approximated with a simple diffusion model. This does not preclude its use in other fields of research. The anticipated use cases are described in the vignettes (articles)

The package builds on the work of Multerer et al. (2021a), Multerer et al. (2021b) and Anaya-Izquierdo & Alexander(2021).

Code of Conduct

Please note that the CRTspat project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Installation

CRTspat is on CRAN and on github. It can be installed from CRAN.

Copy Link

Version

Install

install.packages('CRTspat')

Monthly Downloads

336

Version

1.4.0

License

MIT + file LICENSE

Maintainer

Thomas Smith

Last Published

January 21st, 2026

Functions in CRTspat (1.4.0)

randomizeCRT

Randomize a two-armed cluster trial
summary.CRTanalysis

Summary of the results of a statistical analysis of a CRT
readdata

Read example dataset
summary.CRTsp

Summary description of a "CRTsp" object
fitted.CRTanalysis

Extract model fitted values
latlong_as_xy

Convert lat long co-ordinates to x,y
CRTpower

Power and sample size calculations for a cluster randomized trial
CRTwrite

Export of GIS layer from 'CRTsp'
compute_mesh

Create INLA mesh for spatial analysis
CRTanalysis

Analysis of cluster randomized trial with spillover
coef.CRTanalysis

Extract model coefficients
CRTsp

Create or update a "CRTsp" object
compute_distance

Compute distance or surround values for a cluster randomized trial
aggregateCRT

Aggregate data across records with duplicated locations
CRTspat-package

CRTspat: Workflow for Cluster Randomised Trials with Spillover
anonymize_site

Anonymize locations of a trial site
predict.CRTanalysis

Model predictions
simulateCRT

Simulation of cluster randomized trial with spillover
plotCRT

Graphical displays of the geography of a CRT
specify_clusters

Assign locations to clusters in a CRT
specify_buffer

Specification of buffer zone in a cluster randomized trial
residuals.CRTanalysis

Extract model residuals