GLS.fit() doesn't attach results to self

Bug #428895 reported by joep
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
statsmodels
Fix Released
Undecided
Unassigned

Bug Description

GLS.fit() doesn't attach results to self, as a consequence predict fails because of missing results
GLS.results works correctly

Shall we downgrade the fit() method and recommend the use of GLS.results instead, or keep duplicate functionality between fit (method) and results (property) ?

>>> res = sm.OLS(y, X).fit()
>>> res.model.predict(X)
Traceback (most recent call last):
  File "c:\josef\eclipsegworkspace\statsmodels_trunk2\scikits\statsmodels\regression.py", line 270, in predict
    raise ValueError, "If the model has not been fit, then you must specify the params argument."
ValueError: If the model has not been fit, then you must specify the params argument.

Revision history for this message
Skipper Seabold (jsseabold) wrote :

There are two issues here I think underlying this.

The more I thought about it, the more I don't like having the results property. Some models (GLM, etc.) have a fit that takes arguments, so having a results property that returns the fit with default arguments isn't that useful (and I'd like most of the models to be as streamlined as possible).

Also, I'm not sure it makes sense to have predict as a method of the model rather than the results. I tried to connect the two, hence the error that is raised, but having a model method that depends on fit already being called is a bit odd to think about. Maybe it does though for the experimental guys who know what their params should be. I don't know.

This can be fixed, but I think we should make the design decision that this problem is a symptom of before we fix it.

Revision history for this message
Skipper Seabold (jsseabold) wrote :

Fix commited in my branch. I took the simplest route on this one. The more I think about it, maybe it makes sense to have predict as a method of the model.

Changed in statsmodels:
status: New → Fix Committed
Changed in statsmodels:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.