Re: [R] Use of survreg.distributions

From: Terry Therneau <therneau_at_mayo.edu>
Date: Fri, 25 Apr 2008 07:46:45 -0500 (CDT)


--begin included message ---
 

I am using survreg(Surv()) for fitting a Tobit model of left-censored longitudinal data. For logarithmic transformation of y data, I am trying use survreg.distributions in the following way: tfit=survreg(Surv(y, y>=-5, type="left")~x + cluster(id), dist="gaussian", data=y.data, scale=0, weights=w)

my.gaussian<-survreg.distributions$gaussian
my.gaussian$name="lognormal"
my.gaussian$dist<-my.gaussian

tfit=survreg(Surv(y, y>=-5, type="left")~x + cluster(id), dist=my.gaussian, data=y.data, scale=0, weights=w)  

If I run these codes then I got the following error message,  

Error in survreg(Surv(y, y >= -5, type = "left") ~ x + : Invalid distribution object

Does anybody can help me in identifying the error(s) in these code please?  

  Can you tell us what you are trying to do?   Your first model was a fit of y ~ x + eps, eps ~ Gaussian. If what you want is log(y) ~ x + eps, then all that you need do is use dist="loggaussian" in the survreg call. (Or 'lognormal'; which is the same distribution.)   

          Terry Therneau



R-help_at_r-project.org mailing list
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. Received on Fri 25 Apr 2008 - 12:57:51 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 25 Apr 2008 - 13:30:31 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive