CRTanalysis {CRTspat}R Documentation

Analysis of cluster randomized trial with spillover


CRTanalysis carries out a statistical analysis of a cluster randomized trial (CRT).


  method = "GEE",
  distance = "nearestDiscord",
  scale_par = NULL,
  cfunc = "L",
  link = "logit",
  numerator = "num",
  denominator = "denom",
  excludeBuffer = FALSE,
  alpha = 0.05,
  baselineOnly = FALSE,
  baselineNumerator = "base_num",
  baselineDenominator = "base_denom",
  personalProtection = FALSE,
  clusterEffects = TRUE,
  spatialEffects = FALSE,
  requireMesh = FALSE,
  inla_mesh = NULL



an object of class "CRTsp" or a data frame containing locations in (x,y) coordinates, cluster assignments (factor cluster), and arm assignments (factor arm) and outcome data (see details).


statistical method with options:

"EMP" simple averages of the data
"T" comparison of cluster means by t-test
"GEE" Generalised Estimating Equations
"LME4" Generalized Linear Mixed-Effects Models
"INLA" Integrated Nested Laplace Approximation (INLA)
"MCMC" Markov chain Monte Carlo using "JAGS"
"WCA" Within cluster analysis

Measure of distance or surround with options:

"nearestDiscord" distance to nearest discordant location (km)
"disc" disc
"kern" surround based on sum of normal kernels
"hdep" Tukey half space depth
"sdep" simplicial depth

numeric: pre-specified value of the spillover parameter or disc radius for models where this is fixed (cfunc = "R").


transformation defining the spillover function with options:

"Z" arm effects not considered reference model
"X" spillover not modelled the only valid value of cfunc for methods "EMP", "T" and "GEE"
"L" inverse logistic (sigmoid) the default for "INLA" and "MCMC" methods
"P" inverse probit (error function) available with "INLA" and "MCMC" methods
"S" piecewise linear only available with the "MCMC" method
"E" estimation of scale factor only available with distance = "disc" or distance = "kern"
"R" rescaled linear

link function with options:

"logit" (the default). numerator has a binomial distribution with denominator denominator.
"log" numerator is Poisson distributed with an offset of log(denominator).
"cloglog" numerator is Bernoulli distributed with an offset of log(denominator).
"identity" The outcome is numerator/denominator with a normally distributed error function.

string: name of numerator variable for outcome


string: name of denominator variable for outcome data (if present)


logical: indicator of whether any buffer zone (records with buffer=TRUE) should be excluded from analysis


numeric: confidence level for confidence intervals and credible intervals


logical: indicator of whether required analysis is of effect size or of baseline only


string: name of numerator variable for baseline data (if present)


string: name of denominator variable for baseline data (if present)


logical: indicator of whether the model includes local effects with no spillover


logical: indicator of whether the model includes cluster random effects


logical: indicator of whether the model includes spatial random effects (available only for method = "INLA")


logical: indicator of whether spatial predictions are required (available only for method = "INLA")


string: name of pre-existing INLA input object created by compute_mesh()


CRTanalysis is a wrapper for the statistical analysis packages: geepack, INLA, jagsUI, and the t.test function of package stats.

The wrapper does not provide an interface to the full functionality of these packages. It is specific for typical analyses of cluster randomized trials with geographical clustering. Further details are provided in the vignette.

The key results of the analyses can be extracted using a summary() of the output list. The model_object in the output list is the usual output from the statistical analysis routine, and can be also be inspected with summary(), or analysed using stats::fitted() for purposes of evaluation of model fit etc..

For models with a complementary log-log link function specified with link = "cloglog". the numerator must be coded as 0 or 1. Technically the binomial denominator is then 1. The value of denominator is used as a rate multiplier.

With the "INLA" and "MCMC" methods 'iid' random effects are used to model extra-Poisson variation.

Interval estimates for the coefficient of variation of the cluster level outcome are calculated using the method of Vangel (1996).


list of class CRTanalysis containing the following results of the analysis:


example <- readdata('exampleCRT.txt')
# Analysis of test dataset by t-test
exampleT <- CRTanalysis(example, method = "T")
# Standard GEE analysis of test dataset ignoring spillover
exampleGEE <- CRTanalysis(example, method = "GEE")
# LME4 analysis with error function spillover function
exampleLME4 <- CRTanalysis(example, method = "LME4", cfunc = "P")

[Package CRTspat version 1.2.0 Index]