# Performing model validation in stata

I need to validate a cox-regression model internally - i was thinking of either k-fold cross validation or bootstrapping methods. are either of these possible to do with a cox model? any idea how to perform these? an example of our stepwise regression is below:

sw, pr(0.05): stcox age3 apricat2 meldcat2 etiol5a sex if yrs>=0.5

For "cox" read "Cox" throughout: Sir David Cox, whose name you are using, is no relation, but I'm sensitive on that detail.

In principle, certainly you can bootstrap and see how much variability there is. But the bootstrap command you might most naturally turn to expects you to work with named scalar quantities, most notably parameter estimates or figures of merit. So, you need to decide what results you want to focus on. There is no magic command that says "bootstrap this and report on variability".

Your use of stepwise fitting through the sw command is a matter of taste (which I don't share, but that is another story). But in principle doing things stepwise can only complicate your comparisons. Suppose different predictors are included in the final model in different replications; how are you going to handle that?

Cross-validation raises similar issues. In general terms, you would need to write much more code for that. If you are not an experienced Stata programmer, you are best advised to back off.

My reply, like your question, is sketchy and based mostly on general Stata experience.

There is an example on how to use the bootstrap the check the stability of which variables were selected using stepwise in combination with Cox regression here:

http://www.stata.com/statalist/archive/2011-05/msg01427.html