Thanks for your advise, David. I did read the help for survreg and using the followings to calculate.
survreg's scale = 1/(rweibull shape) survreg's intercept = log(rweibull scale) However, the scale in rweibull has been transformed by exp(betaX's). In my case, the baseline hazard for T is 0.004. I'm wondering if it's possible to get the estimated baseline hazard by the output from survreg. Thank you very much. On Tue, Mar 6, 2012 at 5:06 PM, David Winsemius <dwinsem...@comcast.net>wrote: > > On Mar 6, 2012, at 5:53 PM, FU-WEN LIANG wrote: > > Hi all, >> >> I'm trying to generate a Weibull distribution including four covariates in >> the model. Here is the code I used: >> >> T = rweibull(200, shape=1.3, >> scale=0.004*exp(-(-2.5*b1+2.5***b2+0.9*x1-1.3*x2)/1.3)) >> C = rweibull(n, shape=1.5, scale=0.008) #censoring time >> time = pmin(T,C) #observed time is min of censored and true >> event = time==T # set to 1 if event is observed >> return(cbind(time,event,T,C)) >> >> And then, I used this dataset to fit a Weibull regression mode: >> >> survreg(Surv(time, event)~b1+b2+x1+x2, dist='weibull') >> >> The result I got was: >> Intercept b1 b2 x1 x2 Scale >> -3.983 1.916 -1.828 -0.808 1.022 0.778 >> >> I transformed those estimates into: >> >> Shape = 1/0.778=1.3 >> beta1 = -1.916/0.778 = -2.5 >> beta2 = -(-1.828)/0.778 = 2.5 >> beta3 = -(-0.808)/0.778 = 1.0 >> beta4 = -1.022/0.778 = -1.3 >> scale = exp(-3.983) = 0.0186 >> >> From the result, we can see all parameter estimates are close to the >>> >> initial values, except for scale. The baseline scale is 0.004. >> The scale parameter is varying by covariates. >> If so, how can I double check if the estimated baseline scale is close to >> the initial baseline scale? >> > > Please read the read the help() for 'survreg' and make sure you follow the > links provided and work through the examples. > > > > Please advise if my concept >> > > The concept is the problem. > > > > or code is not correct. >> >> Thank you very much. >> > > -- > > David Winsemius, MD > West Hartford, CT > > [[alternative HTML version deleted]] ______________________________________________ R-help@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.