lifelines icon indicating copy to clipboard operation
lifelines copied to clipboard

How to fix the error "Diagonal of the variance_matrix_ has negative values or NaNs while using Gompertz function?

Open aitnuhk opened this issue 4 years ago • 2 comments

While running the example of Gompertz function using the waltons dataset, I encountered this error:

`.local/lib/python3.6/site-packages/lifelines/fitters/init.py:994: StatisticalWarning:

The diagonal of the variance_matrix_ has negative values or NaNs. This could be a problem with GompertzFitter's fit to the data.

It's advisable to not trust the variances reported, and to be suspicious of the fitted parameters too. Perform plots of the cumulative hazard to help understand the latter's bias.

To fix this, try specifying an initial_point kwarg in fit.`

Any idea how to fix it? Is it only me or someone else facing the same issue?

aitnuhk avatar Nov 08 '21 23:11 aitnuhk

Any help on this? Thanks

aitnuhk avatar Jan 12 '22 11:01 aitnuhk

I faced with the same problem. In my case, normalization of durations T = T/T.max() led to a convergence of the solution.

shappiron avatar Sep 12 '22 12:09 shappiron