WELCOME TO THE
SELF CONTROLLED CASE SERIES METHOD
Start by reading in the data, which lists one record per event. For our Oxford meningitis example, data can be read in as in table II in the tutorial paper. Days can be given as ages (in days) or as the number of days difference from the start of the observation period. Variates are labelled as follows:
indiv is converted to a factor with ordinal levels. For the MMR and meningitis in Oxford example, also read in exday, the day on which the vaccine was given and hence exposure started, though what is needed are variates for the day before a risk period starts or the day a risk period ends.
Calculate the day before the exposure risk period for each individual as exday + 14 days, and the end of the exposure risk period as exday + 35 days. Note that exposure risk groups cannot overlap, consecutive cut off points must be increasing (or equal to skip out a risk group). All exposure risk group cut points are put into a pointer structure, ex. A variate exc lists factor levels corresponding to each risk group, this should start and end with the baseline level (which we define to be 0), and should be of length 1 + length of ex. Thus ex contains 0 1 0 in this example.
All age group cut points (the day before the start of a new age group or the end of an age group) are listed in a variate t, there is no need to include the beginning of the first, or end of the last age groups. t only contains one age group cut point at day 547 in this example.
What explanatory variables to fit also needs to be provided, for the simple MMR and meningitis example, this will be exposure_group + age_group. Once all this is done, call up the file 'sccs.gen'. Note that we also wish to fit the individual effects, but GenStat has an option groups in it's model directive (used to fit GLMs) which absorbs nuisance parameters such as the individual effects, this option is already specified in `sccs.gen' so there is no need to list it with the other explanatory variables.
Once sccs.gen has run, the output given includes a summary of the regression analysis, parameter estimates and standard errors from the model, relative risks and confidence intervals for the relative risks, and a table of the number of adverse events within each age group and risk group.
Put these three files into your GenStat working directory:
'oxford.txt', this file contains the MMR and meningitis data.
'oxford.gen', this file contains the commands specific to the MMR and meningitis example.
'sccs.gen', this file contains the commands to reformat the data and fit the model for any case series analysis.
These files were written for GenStat version 7. If you have any trouble downloading the files, please contact Heather Whitaker.
For each individual in turn the GenStat file sccs.gen takes all the cut points for the start and end of the observation period, the risk group cut points and the age group cut points, and sorts them into increasing order. From this list of ordered cut points the difference between subsequent cut points gives the length of each interval, the number of events occurring between cut points are counted and factors for the age and risk groups are assigned. Intervals of zero length and intervals that lie before the start or after the end of the observation period are taken out. It is this process of cutting up the data into intervals that may take some time, once it is done GenStat fits the models quickly.
Save 'itp.txt', the ITP and MMR data, along with the GenStat command files into your GenStat working directory.
(Also Multiple events)
The day of vaccination is read into a variate called mmr. Then calculate the four exposure group cut points (CALC ex1 = mmr - 1, CALC ex2 = mmr + 14 etc..). Risk group factors corresponding to the exposure group cut points are stored in exc. The risk group factors should start and end with the baseline level 0, and in the middle list the relevant factors for between subsequent exposure group cut points, for this example: 0 1 2 3 0.
After reading in the data, create a variate n0 that contains zeros for second or subsequent events. Then use the subset directive to restrict the data to first events - when n0 is not 0.
Save 'intuss.txt', the intussusception and OPV data, along with the GenStat command files into your GenStat working directory.
The day of the third OPV dose is given in the variate p3, and the three exposure group cut points are created by adding 13, 27 and 41 to this. Risk group factors are given as 0 1 2 0.
For analysis 2, sta is re-defined as the day before the third dose p3 - 1. If the new sta falls after end of the observation period it is re-defined again to be the end of the observation period giving an observation period of length 0.
For analysis 3, five exposure group cut points are created by adding -14, -1, 13, 27 and 41 days to p3. Risk group factors are given as 0 1 0 2 3 0. The two-week pre-dose period is coded 1, the period between the third dose and 13 days after is coded 0, and the two post-dose risk periods are coded 2 and 3.
Any covariates need to be factors, and are put into a pointer structure named covariates. Covariates, which will be labelled cov, cov etc... in the order they were placed in the covariates pointer, and can be included as interactions with exposure_group. For this example use: exposure_group + age_group + exposure_group.cov.
For analysis 4 there are nine exposure group cut points: 13, 27 and 41 days after each dose (day of dose given in p1, p2 and p3). Exposure group factors given in exc are 0 1 2 0 1 2 0 1 2 0 i.e. 14-27 days after any dose is coded 1 and 28-41 days after any dose is coded 2, and all time before the first, between and after the third dose risk periods is coded 0.
For analysis 5, the exposure group cut points are the same as for analysis 4, but exposure groups factors given in exc are 0 1 2 0 3 4 0 5 6 0 i.e. each risk period after a dose is given it's own risk factor, and all time before the first, between and after the third dose risk periods is coded 0.
Currently, no files are written for GenStat that can handle multiple exposures.