Hi all,
I'm trying to generate a Weibull distribution including four covariates in
the model. Here is the code I used:
# Generate survival time
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
-3.983 b1 1.916 b2 -1.828 x1 -0.808 x2 1.022 sigma 0.778
I transformed those estimates into:
Alpha = 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.
How can I double check if the estimated baseline scale is close to the
initial baseline scale?
Please advise if my concept or code is not correct.
Thank you very much.
[[alternative HTML version deleted]]