*! version 1.1)

help clan ({})

Title

clan -- Cluster-level analysis of data from a
cluster randomised trial

Syntax

clan
depvar
indepvars
[if] [in]
,
arm(varname)
cluster(varname)
effect(effect)
[options]

Main
* arm(varname) variable defining the (two) trial
arms

* cluster(varname) variable defining the
clusters

* effect(clan##effspec:effect) the effect estimate you want to produce

strata(varname) variable defining the (single)
stratification factor used in the trial

fuptime(varname [, per(#)]) variable describing the follow-up
time in trials where the outcome is a rate (events/person-time) and
unit option

plot produce a scatter plot of cluster summaries

saving(filename [, replace])
save the cluster-level dataset in filename.dta

level(#) set the level for confidence intervals;
default is 95%

*these options are required

indepvars may contain factor variables, but cannot
contain interactions

effect

rr risk ratio

rd risk difference

irr incidence rate ratio

ird incidence rate difference

meand mean difference

Description

clan performs analysis of cluster randomised trials at the
cluster level allowing for stratification and adjustment for
individual- and cluster-level covariates. depvar gives the
outcome, and indepvars give adjustment covariates.

The general idea of a cluster level analysis is that a summary
statistic (mean, proportion, or rate) is calculated for each
cluster, and these can then be compared between trial arms
as independent observations.

If any independent variables are included, an appropriate regression
model (linear, logistic, or Poisson) is run on the outcome with the
independent variables and strata variable but without the arm
variable and ignoring clustering. The residuals are then summarised
by cluster. If no independent variables are included, the outcome itself
is summarised by cluster. For a binary outcome, these summaries are
cluster proportions; for a continuous outcome, they are cluster means;
for a rate (events/person-time) outcome, they are rates. For calculation
of ratio estimators, the command uses the logarithm of the summaries.

These cluster summaries are then compared between the arms in a
linear regression adjusting for the stratification variable if it
is specified.

Degrees of freedom are calculated from the number of clusters and
then penalising by: two to account for the treatment arms; one fewer than
the number of stratification levels; and one for each cluster-level
variable included in the first stage regression.

The data in memory will not be altered by this command.

Options

arm(varname) is the variable which identifies the two trial
arms.
It must be coded 0/1

cluster(varname) is the variable which describes the
clusters. It must be a numeric variable

effect(effect) specifies which measure of effect you wish to
calculate. If rr or irr are specified, the confidence
interval will be calculated on the log scale and the estimate will be
the ratio of geometric means of the cluster summaries. If any
cluster has zero events, 0.5 will be added to all cluster totals to
allow logarithms to be taken

strata(varname) is the variable which identifies the
stratification used in the trial randomisation. Only one
stratification factor is permitted. It must be a numeric categorical variable

fuptime(varname[, per(#)]) specifies the length of time each participant or cluster was in the
study; this is required to
calculate incidence rate differences and ratios. varname is the
variable containing the follow up time. per(#) displays
rates per # person-time

plot produces a scatter plot of the cluster summaries used to
produce the effect measure. For adjusted analyses these will be
summaries of residual values, and hence will not have a direct
interpretation

saving(filename[, replace]) saves a
dataset with the cluster summaries. A new filename is required unless
replace is also specified. replace allows the
filename to be overwritten with new data

level(#) sets the confidence level; the default is level(95)

Examples

Setup

. net get clan

. sysuse mkvtrial, clear

Analyse intervention effect on the knowledge of HIV; estimate risk
ratio

. clan know, arm(arm) clus(community) effect(rr)

Adjust for the effect of age

. clan know i.agegp, arm(arm) clus(community) effect(rr) plot

Also include a stratification factor, and produce a 99%
confidence interval

. clan know i.agegp, arm(arm) clus(community) strata(stratum) effect(rr) level(99)

Calculate risk difference instead, and plot cluster summaries

. clan know, arm(arm) clus(community) effect(rd) plot

Note that when an adjusted model is run, the cluster summaries
are not interpretable

. clan know i.agegp, arm(arm) clus(community) effect(rd) plot

Stored results

clan stores the following in e():

Scalars

e(N) number of clusters

e(df_r) residual degrees of freedom

e(p) p-value

e(lb) lower bound of confidence interval

e(ub) upper bound of confidence interval

e(level) confidence level

Depending on effect specified:

e(rd) estimated risk difference

e(rr) estimated risk ratio

e(ird) estimated incidence rate difference

e(irr) estimated incidence rate ratio

e(meand) estimated mean difference

Macros

e(cmd) clan

e(cmdline) command as typed

e(depvar) name of dependent variable

e(properties) b V

Matrices

e(b) coefficient vector from the regression in the
second stage

e(V) variance-covariance matrix of the estimators

Functions

e(sample) marks estimation sample

References

RJ Hayes and LH Moulton. Cluster Randomised Trials;
Chapman and Hall/CRC; Second edition, 2017; ISBN 9781498728225

RJ Hayes, and S Bennett. Simple sample size calculation for
cluster-randomized trials;
IJE 1999; 28:2:319-326 doi: 10.1093/ije/28.2.319

S Bennett, T Parpia, R Hayes, and S Cousens. Methods for the analysis
of incidence rates in cluster randomized trials; IJE 2002; 31:4:
839-846 doi: 10.1093/ije/31.4.839

Authors

Jennifer Thompson
London School of Hygiene and Tropical Medicine, London, UK
jennifer.thompson@lshtm.ac.uk

Stephen Nash

Baptiste Leurent
University College London, London, UK
baptiste.leurent@ucl.ac.uk