Skip to contents

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

Usage

CRTanalysis(
  trial,
  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
)

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) and outcome data (see details).

method

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
distance

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
scale_par

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

cfunc

transformation defining the spillover function with options:

"Z"arm effects not consideredreference model
"X"spillover not modelledthe 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 linearonly available with the "MCMC" method
"E"estimation of scale factoronly available with distance = "disc" or distance = "kern"
"R"rescaled linear
link

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

string: name of numerator variable for outcome

denominator

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

excludeBuffer

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

alpha

numeric: confidence level for confidence intervals and credible intervals

baselineOnly

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

baselineNumerator

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

baselineDenominator

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

personalProtection

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

clusterEffects

logical: indicator of whether the model includes cluster random effects

spatialEffects

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

requireMesh

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

inla_mesh

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

Value

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

  • description : description of the dataset

  • method : statistical method

  • pt_ests : point estimates

  • int_ests : interval estimates

  • model_object : object returned by the fitting routine

  • spillover : function values and statistics describing the estimated spillover

Details

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

Examples

# \donttest{
example <- readdata('exampleCRT.txt')
# Analysis of test dataset by t-test
exampleT <- CRTanalysis(example, method = "T")
#> No non-linear parameter.  No fixed effects of distance -
summary(exampleT)
#> 
#> =====================CLUSTER RANDOMISED TRIAL ANALYSIS =================
#> Analysis method:  T 
#> Link function:  logit 
#> Model formula:  arm + (1 | cluster) 
#> No modelling of spillover 
#> Estimates:       Control:  0.364  (95% CL:  0.286 0.451 )
#>             Intervention:  0.21  (95% CL:  0.147 0.292 )
#>                 Efficacy:  0.423  (95% CL:  0.208 0.727 )
#> Coefficient of variation:  41.6 %  (95% CL:  31.2 63.1 )
#>  
#> P-value (2-sided):  0.006879064 
# Standard GEE analysis of test dataset ignoring spillover
exampleGEE <- CRTanalysis(example, method = "GEE")
#> No non-linear parameter.  No fixed effects of distance -
summary(exampleGEE)
#> 
#> =====================CLUSTER RANDOMISED TRIAL ANALYSIS =================
#> Analysis method:  GEE 
#> Link function:  logit 
#> Model formula:  arm 
#> No modelling of spillover 
#> Estimates:       Control:  0.373  (95% CL:  0.306 0.445 )
#>             Intervention:  0.228  (95% CL:  0.167 0.305 )
#>                 Efficacy:  0.388  (95% CL:  0.136 0.573 )
#> Coefficient of variation:  41.6 %  (95% CL:  31.2 63.1 )
#> Intracluster correlation (ICC)  :  0.0573  (95% CL:  0.00643 0.108 )
#>  
# LME4 analysis with error function spillover function
exampleLME4 <- CRTanalysis(example, method = "LME4", cfunc = "P")
#> Estimated scale parameter: 0.45 Signed distance -Signed distance to other arm (km)
summary(exampleLME4)
#> 
#> =====================CLUSTER RANDOMISED TRIAL ANALYSIS =================
#> Analysis method:  LME4 
#> Link function:  logit 
#> Measure of distance or surround: Signed distance to other arm (km)
#> Estimated scale parameter: 0.45
#> Model formula:  pvar + (1 | cluster) 
#> Error function model for spillover
#> Estimates:       Control:  0.418  (95% CL:  0.331 0.508 )
#>             Intervention:  0.185  (95% CL:  0.135 0.251 )
#>                 Efficacy:  0.555  (95% CL:  0.329 0.705 )
#> Spillover interval(km):      4.22  (95% CL:  4.2 4.23 )
#> % locations contaminated: 91.6  (95% CL:  90.6 92 %)
#> Total effect            : 0.232  (95% CL:  0.117 0.345 )
#> Ipsilateral Spillover   : 0.0234  (95% CL:  0.013 0.0323 )
#> Contralateral Spillover : 0.0419  (95% CL:  0.0197 0.065 )
#> Coefficient of variation:  41.6 %  (95% CL:  31.2 63.1 )
#> deviance:  1374.215 
#> AIC     :  1382.215 including penalty for the spillover scale parameter
# }