Skip to content

k-folds cross validation with conditional logistic

2 messages · Terry Therneau, Charles C. Berry

#
--begin inclusion --
I have a matched-case control dataset that I'm using conditional
logistic regression (clogit in survival) to analyze.  I'm trying to
conduct k-folds cross validation on my top models but all of the
packages I can find (CVbinary in DAAG, KVX) won't work with clogit
models.  Is there any easy way to do this in R?
-end inclusion --

 The clogit funciton is simply a wrapper for coxph.  
	clogit(case ~ ...  
turns into
	coxph(Surv(dummy, case) ~ ...
where "dummy" is a vector of ones.

Do the packages support coxph models?

Terry T
#
Terry Therneau <therneau at mayo.edu> writes:
Terry,

I do not know the answer to the question you posed, but I suspect the
answer is no.

The cross-validation would need to be done stratum-wise, but that does
not seem to be supported by predict.coxph():
Error in predict.coxph(train.sans.1, newdat = subset(infert, stratum ==  : 
  New data has a strata not found in the original model


One can work around this:
[1] TRUE
but the predicted values are not centered in each stratum as usual with
strata in predict.coxph (if that matters):
1        84       166 
 0.000000 -2.527759 -2.527759
1         84        166 
 1.6851724 -0.8425862 -0.8425862 


Best,

Chuck