Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: out of sample linear prediction in Cox model


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: out of sample linear prediction in Cox model
Date   Thu, 19 Dec 2002 16:26:02 -0000

Lin Zhang

> I have a problem in doing a survival analysis. I used a cox 
> model with 
> weighted sample, the model worked well. Then I wanted to use this 
> fitted model to make linear prediction (the log hazard 
> ratio) based on 
> a NEW dataset, it did not let me do this. I don't know if 
> the cox model 
> can make linear prediction on NEW dataset or the syntax of 
> Stata I used 
> was wrong.
> The Stata commends I used:
> . stset msltime censor [pweight=weight2] if (id!=9999)
> . stcox exp s1 s2 s3 bmi gender agemslt if (id!=9999)
> . predict xb if id==9999, xb
>   (I got all missing values for the prediction)
> . predict std if id==9999, stdp
>   (I got all missing values for the prediction) 
> 
> It can make prediction on the used dataset. I tried 
> non-weighted cox 
> model, it also did not work.
> 

Not my territory, but here's a guess: 
check that all covariates 

s1 s2 s3 bmi gender agemslt

are non-missing whenever id is 9999. 

egen rmiss = rmiss(s1 s2 s3 bmi gender agemslt) 
l if rmiss > 0 and id == 9999 

Nick 
[email protected] 
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index