[R] post a message - R help. Surivival analysis and goodness of fit

David Winsemius dwinsemius at comcast.net
Fri Nov 6 06:16:33 CET 2015


> On Nov 5, 2015, at 6:34 AM, Luke Gaylor <luke.gaylor at live.com.au> wrote:
> 
> Hello there,
> 
> I have registered for both through nabble and R-help-request with this email.
> 
> I want to post the following question:
> 
> I want to implement a Hosmer Lemeshow Goodness of Fit test to my survival analysis.
> In R we can use the hoslem.test() function.
> The x values are our observations, and y are our fitted probabilities.
> 
> So we can take the following data:
> 
> s <- Surv(ovarian$futime, ovarian$fustat)
> sWei <- survreg(s ~ age,dist='weibull',data=ovarian)
> 
> so here we assume a weibull distribution. I want to do a HL GOF test to see, if this is an invalid assumption.
> Now how do we get our predicted probabilities. I assume it is with the predict() function.
> I have tried the code, but it is not correct

(It would be better to post the reason for your conclusion of “incorrectitude”. Error? Unexpected result? )


> predict(sWei, newdata=list(ovarian$age), type = 'response’)

This code had an unmatched single quote because the flanking character was a”smart-quote. I’m side-stepping the wisdom of using an HL GOF test of a distrubutional assumption. I suspect that the argument to newdata will not have a name. Try:

 predict(sWei, newdata=list(age = ovarian$age), type = ‘response')

Or, since you jsut want the original data to be the basis:

 predict(sWei,  type = ‘response')

— 
David.

> 		 	   		  
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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



More information about the R-help mailing list