[R] Scale parameter in Weibull distribution
David Winsemius
dwinsemius at comcast.net
Wed Mar 7 22:51:22 CET 2012
On Mar 6, 2012, at 6:19 PM, FU-WEN LIANG wrote:
> 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.
Questions about the "baseline hazard" need more careful definition.
Is there a set of parameters or data which you want to call a
"baseline" group? Or do you want the hazard function for the group as
a whole , i.e. fitmean <- survreg(Surv(time, event) ~ 1) ? At the
moment you seem to be using the term "baseline hazard" to describe
cases where all parameters and covariates sum to zero. So wouldn't
that just be the weibull(Intercept*t, scale)?
I do not see any x1 or x2 and its unclear what estimates for b1 and b2
would be since you have fixed their parameters with opposite signs but
equal magnitudes.
> Thank you very much.
>
> On Tue, Mar 6, 2012 at 5:06 PM, David Winsemius <dwinsemius at 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))
>
It's certainly not reproducible. As noted before, all of the x's and
b's are missing in action and the return() at the end does not seem to
be occuring in a function body.
> 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
>
>
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list