chjackson / flexsurv

The flexsurv R package for flexible parametric survival and multi-state modelling
http://chjackson.github.io/flexsurv/
53 stars 28 forks source link

Can't Tidy Exponential Model #95

Closed ApexHeel closed 2 years ago

ApexHeel commented 3 years ago

Fitting parametric regressions with flexsurvreg, I can tidy the Weibull, log-normal, log-logistic, Gompertz, and generalized gamma. However, when attempting to tidy a simple exponential fit, you get "Error: Input must be a vector, not NULL."

I am able to tidy the same model when running that with survreg.

Reproducible code:

library(survival) library(flexsurv)

sr_exp <- survreg(formula = Surv(futime, fustat) ~ 1, data = ovarian, dist = "exp") fsr_exp <- flexsurvreg(formula = Surv(futime, fustat) ~ 1, data = ovarian, dist = "exp")

tidy(sr_exp) tidy(fsr_exp)

Console:

library(survival) library(flexsurv)

sr_exp <- survreg(formula = Surv(futime, fustat) ~ 1, data = ovarian, dist = "exp") fsr_exp <- flexsurvreg(formula = Surv(futime, fustat) ~ 1, data = ovarian, dist = "exp")

tidy(sr_exp)

A tibble: 1 x 5

term estimate std.error statistic p.value

1 (Intercept) 7.17 0.289 24.8 3.72e-136 tidy(fsr_exp) Error: Input must be a vector, not NULL. Run `rlang::last_error()` to see where the error occurred.
chjackson commented 3 years ago

Thanks for the report - now fixed in https://github.com/chjackson/flexsurv-dev/commit/1a7795ec0b670cff9b8b158d9a47084403e2a403 .