FAQ/clogit - CBU statistics Wiki
location: FAQ / clogit

# Conditional logistic regression using R

Taken from Agresti (2002). Fuller details are given here. The below R code is used on the data below (first five case-controls are listed)

```> table.10.3
pair MI diabetes
1      1  0        1
2      1  1        1
3      2  0        1
4      2  1        1
5      3  0        1```

R code:

```library(survival)

table.10.3<-data.frame(pair=rep(1:144,rep(2,144)), MI=rep(c(0,1),144),
diabetes=c(rep(c(1,1),9),rep(c(1,0),16),rep(c(0,1),37),rep(c(0,0),82))
)

# Can use coxph routine equiavelently to clogit

#fit.CLR<-coxph(Surv(rep(1,2*144),MI)~diabetes+strata(pair),method="exact",
#data=table.10.3)

library(survival)
fit.CLR<-clogit(MI~diabetes+strata(pair),method="exact", data=table.10.3)
summary(fit.CLR)```

This gives the output:

```Call:
clogit(MI ~ diabetes + strata(pair), method = "exact", data = table.10.3)

coef exp(coef) se(coef)   z      p
diabetes 0.838      2.31    0.299 2.8 0.0051

Likelihood ratio test=8.55  on 1 df, p=0.00345  n= 288 ```

The clogit procedure (unlike the SPSS Cox model) can be used to stratify more than two matched observations ie three or more repeated counts on each of n subjects. See for example Whitaker at al. (2005) with accompanying clogit R code from Helen Whitaker's website here.

Xu et al. (2011) suggest a graphical diagnostic tool to choose the best lag time from trigger (e.g. stress) to event (e.g. epileptic seizure) whilst Farrington and Hocine (2010) advocate checking for clustering of events and using only the first event in each cluster to remove bias resulting from correlated events.

References

Agresti A (2002) Categorical Data Analysis. Second Edition. Wiley:New York.

Farrington CP and Hocine MN (2010) Within-individual dependence in self-controlled case series models for recurrent events. Applied Statistics 59(3) 457-475. A copy is available here.

Whitaker HJ, Farrington, CP, Spiessens B. and Musonda P. (2006) Tutorial in biostatistics:the self-controlled case series method. Statistics in Medicine 25(1) 1768-1797. An earlier 2005 pdf draft of this paper is given here.

Xu S, Zhang L, Nelson JC, Zeng C, Mullooly J, McClure D and Glanz J (2011) Statistics in Medicine 30 742-752. Plotting to find optimal time at risk for each trigger on an individual.

None: FAQ/clogit (last edited 2014-03-07 09:54:51 by PeterWatson)