flexsurv-dev icon indicating copy to clipboard operation
flexsurv-dev copied to clipboard

coxsnell_flexsurvreg fails if the model formula contains a function call

Open chjackson opened this issue 1 year ago • 0 comments

coxsnell_flexsurvreg fails when the formula contains a transformation.

fitg <- flexsurvreg(formula = Surv(futime, fustat) ~ factor(ecog.ps),  data = ovarian, dist = "gengamma")
coxsnell_flexsurvreg(fitg)

Users can work around this by transforming their data before calling flexsurvreg. However it would be nice to handle this properly.
Just as in https://github.com/chjackson/flexsurv/issues/167 it seems like the function stats::get_all_vars would be useful to get the untransformed data used in a formula, but this fails for the cases demonstrated in https://github.com/chjackson/flexsurv/issues/167#issuecomment-1836534022

Suggestions appreciated!

chjackson avatar Feb 17 '24 16:02 chjackson