# [R] Scale parameter in Weibull distribution

David Winsemius dwinsemius at comcast.net
Wed Mar 7 00:06:49 CET 2012

```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?

the links provided and work through the examples.

The concept is the problem.

> or code is not correct.
>
> Thank you very much.

--

David Winsemius, MD
West Hartford, CT

```