You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MixedLM.hessian() returns a tuple instead of just the hessian matrix, causing MixedLM.fit to fail when minimizing with methods that require the hessian
#9139
Open
pcuestas opened this issue
Feb 3, 2024
· 1 comment
The parameters to use when evaluating the Hessian.
Returns
-------
ndarray
The hessian evaluated at the parameters.
"""
The fact that MixedLM.hessian() returns a tuple causes optimization to fail when the hessian matrix is used in the minimization algorithm, when the following function is called (within MixedLM.fit()):
As I recall that Hessian function is intended to be used for standard errors, not for optimization. The optimization uses a different parameterization that is not compatible with the Hessian function you are referring to. Optimization should use a first order or zeroth order approach that do not rely on Hessian matrices.
Describe the bug
MixedLM.hessian()
returns a tuple:statsmodels/statsmodels/regression/mixed_linear_model.py
Lines 1855 to 1878 in 23faea3
statsmodels/statsmodels/regression/mixed_linear_model.py
Line 2029 in 23faea3
However, it is supposed to return just the hessian matrix, as stated in
LikelyhoodModel.hessian()
:statsmodels/statsmodels/base/model.py
Lines 332 to 345 in 23faea3
The fact that
MixedLM.hessian()
returns a tuple causes optimization to fail when the hessian matrix is used in the minimization algorithm, when the following function is called (withinMixedLM.fit()
):statsmodels/statsmodels/base/model.py
Lines 547 to 548 in 23faea3
(The exception
TypeError: bad operand type for unary -: 'tuple'
is thrown).The text was updated successfully, but these errors were encountered: