[R] Help with clogit in survival - conditional logistic regression

Ashraf Chaudhary mchaudha at jhsph.edu
Sat Jul 29 04:02:39 CEST 2006


Dear All:
I have been struggling to run the conditional logistic regression on a
dataset. I am using clogit function in survival package. Here is how the
data is generated. I tried to shorted the data by using the second count
variable but still the clogit did not run. Why I am not able to run clogit
on my dataset. I appreciate any input.
Regards,
Ashraf

age  <- c(rep(0,8),rep(1,8))
scc <-  c(1,1,1,0,0,1,0,0,1,1,1,0,0,1,0,0)
case <- rep(c(1,0),8)
count <- c(5,5,216,216,110,110,40,40,5,5,308,308,212,212,21,21)
#count <- c(2,5,3,5,4,6,2,4,2,5,1,3,1,4,2,5)
agescc <- age*scc

# Grouped data
clmatch  <- data.frame(age,case,scc,agescc,count)

# Ungrouping the data as clogit as I can not use weights=count
clmatch1 <- data.frame(lapply(clmatch, function(x)
rep(x,clmatch$count)))[,1:4]

# Sorting by age and case for clogit - I think it is not necessary
ii <- order(clmatch1$age,clmatch1$case)
clmatch2 <- clmatch1[ii,]
clmatch2

clogit(case~scc+agescc+strata(age),data=clmatch2)


-----------------______________________________________
M. Ashraf Chaudhary, Ph.D.
Associate Scientist/Biostatistician
Department of International Health
Johns Hopkins Bloomberg School of Public Health
615 N. Wolfe St.  Room W5506
Baltimore MD 21205-2179

(410) 502-0741/fax: (410) 502-6733
mchaudha at jhsph.edu
Web:http://faculty.jhsph.edu/?F=Mohammad&L=Chaudhary



More information about the R-help mailing list