chjackson / flexsurv

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

parametrization of gamma AFT model #92

Closed FBartos closed 3 years ago

FBartos commented 3 years ago

Hi, the coefficients of the gamma model seem to be in the opposite direction than the remaining AFT families. I suspect that it is a bug (there is also a warning message about NaNs but I guess that it's unrelated).

flexsurvreg(Surv(recyrs, censrec) ~ group, data = bc, dist = "lognormal")
flexsurvreg(Surv(recyrs, censrec) ~ group, data = bc, dist = "llogis")
flexsurvreg(Surv(recyrs, censrec) ~ group, data = bc, dist = "gamma")
flexsurvreg(Surv(recyrs, censrec) ~ group, data = bc, dist = "gengamma")
flexsurvreg(Surv(recyrs, censrec) ~ group, data = bc, dist = "genf")
flexsurvreg(Surv(recyrs, censrec) ~ group, data = bc, dist = "weibull")

Best, Frantisek

chjackson commented 3 years ago

This is intentional, for consistency with how the gamma is defined in base R, which by default uses the rate rather than the scale. It's also consistent with the exponential.

The new version has a new vignette where these covariate effects are explained: https://cran.r-project.org/web/packages/flexsurv/vignettes/distributions.pdf. Note flexsurv is not designed specifically for AFT modelling, but for flexible modelling in general.

The NaN warning messages are addressed in the development version, see https://github.com/chjackson/flexsurv-dev/issues/91

FBartos commented 3 years ago

I see. Sorry, I only checked the manual, not the vignettes. I understand the intention.