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

From: Ashraf Chaudhary <mchaudha_at_jhsph.edu>
Date: Sat 29 Jul 2006 - 12:02:39 EST

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.

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,]


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

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sat Jul 29 12:12:02 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 29 Jul 2006 - 14:16:21 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.