Good morning,
I have been trying to do a stratified logistic regression in R after matching for a Case/Control study and encountered a in my opinion unexpected mistake. I have reproduced the error using the mtcars data set:
test=mtcars
test$am=as.factor(test$am)
test$cyl=as.factor(test$cyl)
test$vs=as.factor(test$vs)
library(survival)
clogit(am~vs+strata(cyl),data=test)
Error in coxph(formula = Surv(rep(1, 32L), am) ~ vs + strata(cyl), data = test, : Cox model doesn't support "mright" survival data
In my understanding the clogit-function creates the time parameter, which R seemingly has a problem with. The mistake disappears, when I don't use a am as a factor, but that is the whole, but don't I have to label it as a factor in order to do a logistic regression?
By the way, I am using R 3.2.2 and survival package 2.41-3, but since it seems both functions involved are from the survival package, this shouldn't be the root of the problem here, right? Or is this mistake not reproducable under a newer R-Version?
I think either @MarcoSandri or Member0815 should have put in code that illustrated this solution so that the question could be seen as "answered".