chjackson / flexsurv

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

Again: Flexsurvspline: initial value in 'vmmin' is not finite #199

Open Lee-xli opened 2 weeks ago

Lee-xli commented 2 weeks ago

Hi flexsurv,

Firstly, my apologies that this appears to be an old question, and I do not have a reprex example or a sharable dataset due to data-sharing agreements. The dataset has only four variables: treatment arm, linear predictor, status, and time. Total of 502 observations with 201 events.

The flexsurvspline command was:

Screenshot 2024-11-10 at 7 14 25 am

And I encountered the following error:

zero inits from xgb

I have reviewed past discussions and tried the following:

Unfortunately, all the above efforts failed.

What baffles me is that the error appears to be resolved by replacing the linear predictor variable with a different set of estimates (e.g., linear predictors from a different model). With this alternative linear predictor variable, the flexsurvspline function derived the same knot positions as before, but all gamma parameters now had non-zero initial values. How could this issue seemingly be resolved while the underlying survival information remained unchanged?

Could you please suggest areas where I might further investigate this issue?

Please let me know if my question requires any clarification.

Thank you very much in advance.

chjackson commented 2 weeks ago

So you can successfully fit a model for the same outcome but with a different predictor? That is not surprising - the heuristics used to generate initial values depend jointly on the outcome and the predictors.

If these heuristics fail, you can specify initial values explicitly through the inits argument to flexsurvspline. For example, you could try the estimates of gamma (and/or the estimated covariate effects) from the successful fit as initial values for the model that didn't work.

Lee-xli commented 2 weeks ago

Thank you very much! Having inits from the successful fit indeed fixed the issue. If I weren't so lucky to have a successful fit to guide me on the values (I tried randomly assigning initial values, but none worked), what other approaches would you recommend?

chjackson commented 2 weeks ago

For the effects of covariates in a proportional hazards model, you could just fit a standard Cox model. For the gamma parameters I don't know of any other approach other than the one the package uses already. I'll leave this issue open in case any readers have any better ideas.

Lee-xli commented 1 week ago

Thank you very much again!