R – Parameter Estimation in Survival Analysis Using r survival::survreg Function

r

I have some difficulties understanding the use of the formula in survival::survreg. I am trying to estimate weibull parameters for different groups of data. For convenience I want to use the formula to group the data. Please consider the following code:

library(survival)

a <- rweibull(500, scale = 4, shape = 2)
a.ind <- rep('a', length(a))
b <- rweibull(700, scale = 6, shape = 3)
b.ind <- rep('b', length(b))

A <- data.frame(ttf = c(a,b), group = c(a.ind, b.ind))

fit <- survreg(Surv(ttf)~group, data = A, dist = "weibull")

fit.a <- survreg(Surv(a)~1, dist = "weibull")
fit.b <- survreg(Surv(b)~1, dist = "weibull")

My question is, why are the estimated parameters from fit different to the parameters estimated in fit.a and fit.b (e.g. coef(fit)[1] != coef(fit.a))?

Best Answer

When you fit the model, regardless of the number of groups, only one scale parameter is estimated. If you fix it, then the shape parameter estimates will be the same as you expect:

fit.scale <- survreg(Surv(ttf)~group, data = A, dist = "weibull", scale = 0.5)
fit.a.scale <- survreg(Surv(a)~1, dist = "weibull", scale = 0.5)

> coef(fit.scale)[1]
(Intercept) 
   1.376969 
> coef(fit.a.scale)
(Intercept) 
   1.376969 

(Also note that, as documented in ?survreg.distributions, the parameterization of the survreg Weibull distribution is different from that of rweibull. You can find the conversions in the examples at the bottom of ?survreg.)

Related Question