Michal Figurski
2010-May-26 15:55 UTC
[R] Problem with plotting survival predictions from cph model
Dear R-helpers, I am working with 'cph' models from 'rms' library. When I build simple survival models, based on 'Surv(time, event)', everything is fine and I can make nice plots using plot(Predict(f, time=3)). However, recently I tried to be more specific and used 'Surv(start, stop, event)' type model. Using this model 'plot(Predict(f))' works OK, but 'plot(Predict(f, time=3))' throws an error: "Error in summary.survfit(g, print.it = FALSE, times = times) : object 'n.enter' not found" Actually, using 'survest(f, time=3)' has the same result. Has anybody encountered this kind of error? Is there a workaround? Best regards, -- Michal J. Figurski, PhD HUP, Pathology & Laboratory Medicine Biomarker Research Laboratory 3400 Spruce St. 7 Maloney Philadelphia, PA 19104 tel. (215) 662-3413
Frank E Harrell Jr
2010-May-26 18:20 UTC
[R] Problem with plotting survival predictions from cph model
On 05/26/2010 10:55 AM, Michal Figurski wrote:> Dear R-helpers, > > I am working with 'cph' models from 'rms' library. When I build simple > survival models, based on 'Surv(time, event)', everything is fine and I > can make nice plots using plot(Predict(f, time=3)). > > However, recently I tried to be more specific and used 'Surv(start, > stop, event)' type model. Using this model 'plot(Predict(f))' works OK, > but 'plot(Predict(f, time=3))' throws an error: > > "Error in summary.survfit(g, print.it = FALSE, times = times) : > object 'n.enter' not found" > > Actually, using 'survest(f, time=3)' has the same result. > > Has anybody encountered this kind of error? Is there a workaround? > > Best regards, >Please provide a tiny self-contained reproducible example, e.g., using simulated data. Frank -- Frank E Harrell Jr Professor and Chairman School of Medicine Department of Biostatistics Vanderbilt University
Terry Therneau
2010-May-27 14:44 UTC
[R] Problem with plotting survival predictions from cph model
> but 'plot(Predict(f, time=3))' throws an error:> "Error in summary.survfit(g, print.it = FALSE, times = times) : > object 'n.enter' not found"Congratulations! You just discovered a new, never-before-encountered bug in the survival package. I should have a repair posted to Rforge by the end of the day. Terry Therneau (author of the package)
Michal Figurski
2010-May-28 17:09 UTC
[R] Problem with plotting survival predictions from cph model
Josh, Good point. And it actually accidentally solved my problem. Previously I attached .Rdata files. After your email I exported this dataset into a csv file and then re-loaded it to see if the problem persists, and... the problem disappeared. Nevertheless, if I load the original .Rdata file, the problem is back again. This makes no sense to me - there must be a bug in R, or in the survival package. Regards to all, -- Michal J. Figurski, PhD HUP, Pathology & Laboratory Medicine Biomarker Research Laboratory 3400 Spruce St. 7 Maloney Philadelphia, PA 19104 tel. (215) 662-3413 On 2010-05-27 13:39, Joshua Wiley wrote:> On Thu, May 27, 2010 at 10:32 AM, Michal Figurski > <figurski at mail.med.upenn.edu> wrote: >> >> Actually, I have another problem with the same data - this time with plotting simple KM lines. The dataset is attached. > > Michal, > > Just as a heads up, only certain types of files can be attached, > others get scrubbed. At least I did not see any data attached from > your last two emails. > > Josh > > -- > Joshua Wiley > Senior in Psychology > University of California, Riverside > http://www.joshuawiley.com/