Original Launchpad bug 434420: https://bugs.launchpad.net/statsmodels/+bug/434420
Reported by: josef-pktd (joep).
I started to verify GLSAR against a matlab implementation, and found
that the initial observations are not dropped from wexog and wendog
Shortening the arrays during whitening also will require a
redefinition of self.nobs, which is currently done in the top level
class Model. Is there any reason not to move this assignment down into
GLS ? What's the effect on GLM or RLM?
In GLS self.nobs could be taken from the whitened arrays, similar to
the way in class RegressionResults.
The alternative, that I have used in some other code is that the
superclass checks before an assignment whether the attribute has
already be assigned by the subclass.
e.g. in Model
if not hasattr(self, 'nobs'):
self.nobs = float(self.endog.shape)
(written from memory, not tested for syntax errors)
This could also be used for other cases where a subclass needs to
overwrite some initial attribute assignment, e.g. for the degrees of
I tried it but this doesn't work in this case because wendog is not known yet in init of GLS class.
In my current fix, I overwrite self.nobs in initialize.
Never trust any code that hasn't been tested.
GLSAR looked good in the examples that I looked at before, but I used only statistical comparisons with large nobs, in that case initial conditions have only a small impact.
I have a correction that reproduces the comparison results for given rho (checked for params, bse and tstatistic), but convergence in iterative_fit is not completely the same. Difference in 3rd decimal. Need to check some more but will commit tomorrow.
Not sure what's the status on this, but GLSAR needs a general checkup
Removed the 0.4 milestone from this.
this was fixed, I think with PR #293
has tests against Stata
some review/refactoring issues for GLSAR are still open