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