CRTanalysis carries out a statistical analysis of a cluster randomized trial (CRT).
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,
pixel = 0.1,
control = NULL,
requireMesh = FALSE,
inla_mesh = NULL,
verbose = FALSE
)list of class CRTanalysis containing the following results of the analysis:
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
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 "stan" |
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 | |
"D" | diffusion model | only available with the "MCMC" method | |
"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" or for method = "MCMC")
numeric: size of pixel in km for spatial model (used for method = "MCMC")
list: control options to be passed to the statistical fitting function
(available only for method = "MCMC")
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()
logical: indicator of whether progress indicators, stan code, and the result summary should be returned
CRTanalysis is a wrapper for the statistical analysis packages:
gee,
INLA,
rstan,
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 and the
value of denominator is used as a rate multiplier.
With the "INLA" method '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).
If a control list is provided then this is passed to the 'stan' call. In addition to the values allowed by
'rstan::stan()', the number of iterations can be specified via value of 'iter'.
# \donttest{
example <- readdata('exampleCRT.txt')
# Analysis of test dataset by t-test
exampleT <- CRTanalysis(example, method = "T")
summary(exampleT)
# Standard GEE analysis of test dataset ignoring spillover
exampleGEE <- CRTanalysis(example, method = "GEE")
summary(exampleGEE)
# LME4 analysis with error function spillover function
exampleLME4 <- CRTanalysis(example, method = "LME4", cfunc = "P")
summary(exampleLME4)
# }
Run the code above in your browser using DataLab