4
$\begingroup$

I'd like to run a Weibull regression with the pre-defined scale and shape parameters of the Weibull distribution. I'm using survreg() from library(survival) in R and as I understand in the survreg terminology:

scale = 1/(rweibull shape)
intercept = log(rweibull scale)

Specifying the shape parameter (sic!) by running survreg(Surv(y)~x, scale=1/rweibull_shape) seems to work and, as expected, affects mainly the significance of the regression coefficient for the explanatory variable and not the coefficient itself.

As for the scale parameter I assumed I needed to use offset:

survreg(Surv(y)~x+offset(rep(log(rweibull_scale),length(x))), scale=1/rweibull_shape)

However, specifying the scale this way doesn't seem to affect the model's log likelihood and the significance of regression coefficients, which is surprising given that Weibull variance depends on both shape and scale. What am I doing wrong?

Full example:

## offset –0.1
summary(survreg(y)~x+offset(rep(-0.1,length(x))), dist="weibull", scale=0.143))

Call:
survreg(formula = Surv(y) ~ x + 
offset(rep(-0.1, 4)), dist = "weibull", scale = 0.143)
                   Value Std. Error    z        p
(Intercept)        0.690     0.1599 4.31 1.61e-05
          x        0.406     0.0715 5.68 1.31e-08

Scale fixed at 0.143 

Weibull distribution
Loglik(model)= -6.5   Loglik(intercept only)= -15.1
Chisq= 17.22 on 1 degrees of freedom, p= 3.3e-05 
Number of Newton-Raphson Iterations: 7 
n= 4 


## offset –10
summary(survreg(y)~x+offset(rep(-10,length(x))), dist="weibull", scale=0.143))
Call:
survreg(formula = Surv(y) ~ x + 
offset(rep(-10, 4)), dist = "weibull", scale = 0.143)

                   Value Std. Error     z        p
(Intercept)        10.590    0.1599 66.23 0.00e+00
          x        0.406     0.0715 5.68 1.31e-08

Scale fixed at 0.143 

Weibull distribution
Loglik(model)= -6.5   Loglik(intercept only)= -15.1
Chisq= 17.22 on 1 degrees of freedom, p= 3.3e-05 
Number of Newton-Raphson Iterations: 7 
n= 4 
$\endgroup$
3
$\begingroup$

Without commenting on the validity of the method, from an R formula point of view, you can explicitly remove the intercept term by using -1 or +0

eg

something like

survreg(Surv(y)~x -1 + offset(rep(log(rweibull_scale),length(x))), scale=1/rweibull_shape)

or

survreg(Surv(y)~x+0 + offset(rep(log(rweibull_scale),length(x))), scale=1/rweibull_shape)

Using the example from ?survreg and fixing the shape at 0.2 (as an example, without any reasoning)

survreg(Surv(futime, fustat) ~ ecog.ps + rx+0 + offset(rep(0.2,nrow(ovarian))), 
        ovarian, dist='weibull', scale=1/0.2)

    Coefficients:
 ecog.ps       rx 
1.161230 5.525834 

Scale fixed at 5 

Loglik(model)= -111   Loglik(intercept only)= -110.1
    Chisq= -1.72 on 1 degrees of freedom, p= 1 
n= 26 

Compared with the model where the intercept and scale are estimated

survreg(Surv(futime, fustat) ~ ecog.ps + rx, ovarian, dist='weibull')
Call:
survreg(formula = Surv(futime, fustat) ~ ecog.ps + rx, data = ovarian, 
    dist = "weibull")

Coefficients:
(Intercept)     ecog.ps          rx 
  6.8966931  -0.3850425   0.5286455 

Scale= 0.8838731 

Loglik(model)= -97.1   Loglik(intercept only)= -98
    Chisq= 1.74 on 2 degrees of freedom, p= 0.42 
n= 26 
$\endgroup$
  • $\begingroup$ Thanks, this explains! As for the validity of the method, I share your doubts - just wanted to make sure that survreg() is doing what I think it is before going into this. $\endgroup$ – a11msp Mar 26 '13 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.