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
{{ message }}
Repository navigation
REF/ENH: LikelihoodModel.fit optimization, make hessian optional #1943
In MixedLM hessian is currently not used. While this needs to be refactored, it's not necessary to calculate the Hessian in the super().fit
Another possible case: super().fit might only see the transformed parameterization for the optimization and not the untransformed as it is given to the results and the user.
example: NegativeBinomial I don't see how this works, or why it works:
The Hessian in super().fit is calculated with the setting for self._transparams in effect.
The hessian from the optimization is not overwritten in the model specific fit.
So the hessian should be for the transformed parameterization?
But I thought we have the unit tests for it.
robust cov_params are not affected because I call hessian after self._transparams has been reset to false. (I needed a distribution specific pattern exactly because of this.)
OK, to answer the last part: score is the derivative with respect to the transformed params, but not the hessian.
The problem is that super().fit evaluates the score wrt. the transformed params, but those are not relevant for the results. Except they are used if super also handles robust sandwiches while the _transparams is in effect.
NegativeBinomial is fine except for inconsistent definition of score and hessian wrt transparams.
That's why we cannot use hessian based optimization methods with transparams= True.
Activity
josef-pkt commentedon Aug 31, 2014
temporary bug and prio-high label, until this is checked.
maybe my reading is wrong, maybe there's a bug
check unit tests:
parameters are transformed for estimation if:
if self.loglike_method.startswith('nb') and method not in ['newton', 'ncg']which means default
newtonis not affected, We need to test withbfgs.ENH: base.LikelihoodModel.fit add skip_hessian option see statsmodels…
josef-pkt commentedon Sep 18, 2014
NegativeBinomial doesn't have a bug.
I get the same bse whether I use newton or bfgs. params is adjusted but cov_params/hessian is not adjusted.
the Hessian evaluates the derivative at the transformed value, but it is the derivative wrt. the untransformed parameter. AFAICS
But then, why did I run into problems when I added the robust covariances and cov_type?
josef-pkt commentedon Sep 18, 2014
OK, to answer the last part: score is the derivative with respect to the transformed params, but not the hessian.
The problem is that super().fit evaluates the score wrt. the transformed params, but those are not relevant for the results. Except they are used if super also handles robust sandwiches while the _transparams is in effect.
NegativeBinomial is fine except for inconsistent definition of score and hessian wrt transparams.
That's why we cannot use hessian based optimization methods with
transparams= True.josef-pkt commentedon Sep 18, 2014
no more prio-high for this
ENH: base.LikelihoodModel.fit add skip_hessian option see statsmodels…
josef-pkt commentedon Sep 18, 2014
I opened #1967, so I can close this.
skip_hessianhas been merged in #1952josef-pkt commentedon Sep 18, 2014
as followup: there are still some duplicate calculations especially when sandwich robust covariances are calculated