links probit, CDFLink precision loss in Hessian

Author: josef-pktCreated Aug 10, 2014Updated Sep 28, 2026
Labelscomp-genmodcomp-discretetype-possible-bug

comparing hessian in GLM with hessian of Probit, the agreement is not very high

Are there numerical problems in the numerical second derivatives of the link function?

>>> hess_glm_probit = res_glm_probit_clu.model.hessian(res_probit_clu.params)
>>> print(hess_probit - hess_glm_probit)
[[ 0.03198082 -0.02195936  0.0191278 ]
 [-0.02195936  0.02408385  0.02408385]
 [ 0.0191278   0.02408385 -0.00904406]]
>>> print(hess_probit / hess_glm_probit)
[[ 0.99975476  1.0007156   0.99958227]
 [ 1.0007156   0.99793767  0.99793767]
 [ 0.99958227  0.99793767  1.00047687]]
>>> hess_glm_probit
array([[-130.40437081,  -30.68664568,  -45.79012885],
       [ -30.68664568,  -11.67795402,  -11.67795402],
       [ -45.79012885,  -11.67795402,  -18.96560781]])

>>> print(hess_probit / hess_glm_probit - 1)
[[-0.00024524  0.0007156  -0.00041773]
 [ 0.0007156  -0.00206233 -0.00206233]
 [-0.00041773 -0.00206233  0.00047687]]

in contrast, agreement in score_obs is at floating point precision

>>> sc_probit = res_probit_clu.model.jac(res_probit_clu.params)
>>> sc_glm_probit = res_glm_probit_clu.model.score_obs(res_probit_clu.params)
>>> print(np.max(np.abs(sc_probit - sc_glm_probit)))
4.4408920985e-16

part of cross-checking in #1870 between GLM and other models