[R] survival analysis - predict function

David Winsemius dwinsemius at comcast.net
Mon Oct 16 23:13:31 CEST 2017


> On Oct 16, 2017, at 8:28 AM, Meghna Govil <meghna.govil at gmail.com> wrote:
> 
> Hi
> 
> I'm trying to predict the values for a survreg object called
> loglogistic_na. Here is the definition of loglogistic_na and following that
> the syntax used for the predict function. But upon execution I don't get
> any output. Not sure what I'm doing wrong:
> 
> loglogistic_na <- survreg(Surv(time_na,event_na) ~ t_na, dist="loglogistic")
> summary(loglogistic_na)
> extractAIC(weibull_na)
> extractAIC(loglogistic_na)
> 
> # first way
> l.pred <- predict(loglogistic_na, train1_model)
> l.pred.q <- predict(loglogistic_na, train1_model,
> type="quantile"p=pct,se=TRUE)
> result <- cbind(data.frame(train1_model, l.pred), l.pred.q)
> names(result) <- c("Actual", "Predicted", "Lower", "Upper")
> head(result)
> 
> 
> Thanks
> 
> 	[[alternative HTML version deleted]]

I'm wondering if your failure to provide a data argument to survreg leads to a situation where attempting to use predictions on a newdata argument fails.

-- 
David
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   -Gehm's Corollary to Clarke's Third Law



More information about the R-help mailing list