| WELCOME TO THE
Using R for the self-controlled case
All script files were written by Heather
Whitaker for R version 2.5.0 (free software available from http://www.r-project.org/).
Please let us know if you have any suggestions for improving them.
There are two ways in which we can fit the case
series model after the data have been reformatted:
- Download the gnm
package and use gnm to fit a conditional poisson regression model
with eliminate = indiv (where indiv is a factor for each individual in the
- Use the survival
package (included in R 2.5.0, so no need to download) and
use clogit to fit a logistic regression
model with strata = event (where event is a factor for each event in the data
set, rather than a factor for each individual). Here, we fit a
conditional logistic regression model rather than a conditional poisson
regression model: because recurrent events are assumed to be
independent the conditional logistic likelihood is equivalent if each
event is treated like a separate individual.
We are currently exploring which is the most
efficient. We hope to put R scripts for all the examples in the
tutorial paper here soon. For the time being, here are a few examples
MMR and meningitis in Oxford example
To run the MMR and meningitis in Oxford example
detailed in the tutorial paper save these two files:
'ox.txt', the data in a
tab-delimited text file.
commands in an r script file.
Open oxford.r and select 'run all' under the edit
ITP and MMR example
'itp.r' fits the multiple risk periods example
on p.1782-1783 of the tutorial paper.
'itp.r', r script file
Intussusception and oral polio
'intuss.r' fits analysis 5, repeat exposures
example detailed on p.1787-1789 of the tutorial paper.
'intuss.r', r script
Apologies for the lack of explanation in the script files, we will
update these soon, please ask if you need any help!
R package for the case series
analysis for censored, perturbed or curtailed post event exposures
An R package, adSCCS, has been
written by Ronny Kuhnert (Robert Koch Institute, Berlin) to fit the
extended self-controlled case series method for the situation when no
exposure can occur after an event. This is the method outlined in the
paper: Farrington, Whitaker and Hocine (2008). Case series analysis for
censored, perturbed, or curtailed post-event exposures. Biostatistics,
adSCCS package version 1.5
case series method / Heather Whitaker /
updated May 2007