[R] plot Predicted survival probabilitie

David Winsemius dwinsemius at comcast.net
Sun Jun 9 06:11:29 CEST 2013


On Jun 8, 2013, at 4:58 AM, matteo pettinari wrote:

> Dear
> I would like to find a nice way to plot the predicted survival obtained
> from a cph fit and few covariates as Age etc...
> 
> I am working with "predict" from rms package but i found a problem after
> the lines
> 
> predict(cox5, type="lp", se.fit=FALSE, conf.int=TRUE, conf.type=c('mean'))

Many functions in rms woek better with Predict()

> 
> Error in Getlimi(name[i], Limval, need.all = TRUE) :
>  no limits defined by datadist for variable Age

You need to read:

?datadist

And then create a datyadist and don't do what I do all the time and for get to set the options()

The code you offer does not have the cph call which would have been needed to construct a proper datadist argument. Perhaps something like:

ddname <- datadist(yourdataframe)

options(datadist="ddname")

> --
> 
> 
> can someone give me any advice about this problem and to create nice plot
> with x axis a continuous predictor and y axis the predicted survival?
> 
> Thank you
> Dr. Matteo Pettinari
> matteo.pettinari at gmail.com
> matteo.pettinari at uzleuven.be
> 
> Tervuursestraat 43 | 3000 | Leuven | Belgium
> 
> 	[[alternative HTML version deleted]]

Please learn to post in plain text.


David Winsemius
Alameda, CA, USA



More information about the R-help mailing list