I am fitting a Weibull curve to right censored data. I am doing it by general MLE method using Survival::survreg() as well as Bayesian method using brms::brm.
I am pretty sure that I am getting the model right.
In the results, I am getting similar shape parameter for the Weibull curve for both methods, but the Scale parameter is always (in different datasets) smaller in the Bayesian method.
Take this code for instance, that creates a distribution based on a shape and scale and then fits to them with both methods:
rweibull_cens <- function(n, shape, scale) {
a_random_death_time <- rweibull(n, shape = shape, scale = scale)
a_random_censor_time <- rweibull(n, shape = shape, scale = scale)
observed_time <- pmin(a_random_censor_time, a_random_death_time)
censor <- observed_time == a_random_death_time
tibble(time = observed_time, censor = censor)
}
n = 1e3
rweibull_cens(n, shape = 1.5, scale = 200) -> d
df_fit <- survival::survreg(Surv(time, censor) ~ 1,
data = d,
dist = "weibull"
)
scale <- tidy(df_fit )[1, 2] %>%
rename(scale = estimate) %>%
exp() %>%
round(3)
shape <- tidy(df_fit )[2, 2] %>%
rename(shape = estimate) %>%
exp() %>%
.^-1 %>%
round(3)
d %>%
mutate(censor = if_else(censor == 0, 1, 0)) %>%
brm(time | cens(censor) ~ 1, data = ., family = "weibull", cores = 4) -> bfit
print(bfit, digits = 3)
report = summary(bfit)
bayes_shape = round(report$spec_pars$Estimate,3)
bayes_intercept = round(report$fixed$Estimate,3)
bayes_scale = round(exp(bayes_intercept),3)
print(paste("n =", n))
print(paste("Bayes Shape = ",bayes_shape))
print(paste("Shape = ",shape))
print(paste("Bayes Scale = ",bayes_scale))
print(paste("Scale = ",scale))
I was wondering if anyone can help me why this behavior happens. Thanks
scale
value leads to an underestimate withbrms
. If you have a chance, see what happens with uncensored data and alternate Bayesian Weibull-fitting software. I'm not familiar enough with this type of modeling to know if this behavior is inevitable or represents a problem specific tobrms
. I can't come back to this for a week or so. If the issue isn't resolved by then, I'll put a bounty on this question. $\endgroup$