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
I guess it's (generalized) linear model versus generic MLE. In the first case the tradition is to use (h x'x)^{-1} for cov_params which is the negative hessian and the negative got absorbed in hessian_factor, we add it back for computing hessian, and reverse it again for minimizing negative loglikelihood.
I prefer to have a consistent generic MLE definition but then we need to change every use of current GLM hessian.
This may be related, but we have differing signs for hessian and score when you are using newton vs other optimizers
I guess that might be more related to the definition of the optimizer, i.e. the sign convention used in our home-made "newton" in contrast to the scipy minimizers.
Our "newton" iteration might have been written for a maximization problem.
It cannot be changed in a backwards compatible way, and I'm not sure what the consequences are.
So reverting the sign is not a quickfix. My guess is that we have the same problem in OLS and similar.
In GAM I ran also into problems with a factor of 2, e.g. OLS versus MLE objective function, or min sum of squares versus min 0.5 * sum of squares. OLS/WLS moment conditions do not include the 2 for the former.
The main underlying problem is that estimators based on optimization problems differ from estimators that use first order conditions (moment conditions or estimating equations). The latter are not required to have a fixed sign. e.g. #5674
bottom line: We need to figure out what the generic patterns should be before fixing existing algorithms.
For the definition of llf and loglike, we decided to use only the full version and not to drop any terms that are irrelevant in the optimization problem.
By the same argument we could fix the sign and terms in the score and hessian to be consistent with the optimization problem when there are overlapping cases between optimization and estimating/moment equations.
For moment tests and score_test all we need is consistent sign between score and hessian.
That is sign convention for moment estimators, estimating equations, GMM should be irrelevant for it, as long as those signs are consistent.
Activity
thequackdaddy commentedon Jun 5, 2018
This may be related, but we have differing signs for hessian and score when you are using
newtonvs other optimizersstatsmodels/statsmodels/base/model.py
Line 442 in 47315ce
josef-pkt commentedon Jun 5, 2018
I guess it's (generalized) linear model versus generic MLE. In the first case the tradition is to use (h x'x)^{-1} for cov_params which is the negative hessian and the negative got absorbed in hessian_factor, we add it back for computing hessian, and reverse it again for minimizing negative loglikelihood.
I prefer to have a consistent generic MLE definition but then we need to change every use of current GLM hessian.
josef-pkt commentedon Jun 5, 2018
I guess that might be more related to the definition of the optimizer, i.e. the sign convention used in our home-made "newton" in contrast to the scipy minimizers.
Our "newton" iteration might have been written for a maximization problem.
ENH: add score_factor, hessian_factor to discrete (copy/paste), see a…
ENH: add score_factor, hessian_factor to discrete (copy/paste), see a…
ENH: add score_factor, hessian_factor to discrete (copy/paste), see a…
ENH: add score_factor, hessian_factor to discrete (copy/paste), see a…
ENH: add score_factor, hessian_factor to discrete (copy/paste), see a…
jbrockmendel commentedon May 13, 2019
Is resolving this inconsistency an option? It's affect on the code-base is expanding (#5711)
josef-pkt commentedon May 13, 2019
It cannot be changed in a backwards compatible way, and I'm not sure what the consequences are.
So reverting the sign is not a quickfix. My guess is that we have the same problem in OLS and similar.
In GAM I ran also into problems with a factor of 2, e.g. OLS versus MLE objective function, or min sum of squares versus min 0.5 * sum of squares. OLS/WLS moment conditions do not include the 2 for the former.
The main underlying problem is that estimators based on optimization problems differ from estimators that use first order conditions (moment conditions or estimating equations). The latter are not required to have a fixed sign. e.g. #5674
bottom line: We need to figure out what the generic patterns should be before fixing existing algorithms.
For the definition of llf and loglike, we decided to use only the full version and not to drop any terms that are irrelevant in the optimization problem.
By the same argument we could fix the sign and terms in the score and hessian to be consistent with the optimization problem when there are overlapping cases between optimization and estimating/moment equations.
ENH: add score_factor, hessian_factor to discrete (copy/paste), see a…
josef-pkt commentedon Oct 31, 2021
For moment tests and score_test all we need is consistent sign between score and hessian.
That is sign convention for moment estimators, estimating equations, GMM should be irrelevant for it, as long as those signs are consistent.
OLS/WLS/GLS has hessian_factor but no score_factor
hessian_factor was added as part of
distributedPR 44e1c72#diff-8cb6b075cf3ba145f963655324052ee2647c3554d9bb80e920ac520c8efe17bc