new predict

28 views
Skip to first unread message

josef...@gmail.com

unread,
Feb 8, 2015, 11:48:35 AM2/8/15
to pystatsmodels

Linear Regression - WLS

In [12]:
mod_wls = WLS(y, X, weights=1./w)
res_wls = mod_wls.fit()
 
pred_res = get_prediction(res_wls)
pf = pred_res.summary_frame()
pf.head()
Out[12]:
mean mean_se mean_ci_lower mean_ci_upper obs_ci_lower obs_ci_upper
0 5.110110 0.213037 4.681771 5.538449 3.611625 6.608595
1 5.275544 0.205344 4.862672 5.688417 3.781406 6.769682
2 5.440978 0.197792 5.043292 5.838665 3.950966 6.930991
3 5.606413 0.190395 5.223598 5.989227 4.120300 7.092525
4 5.771847 0.183173 5.403553 6.140141 4.289408 7.254286
In [3]:

josef...@gmail.com

unread,
Feb 8, 2015, 12:17:15 PM2/8/15
to pystatsmodels
switching to plain text

I was trying out a notebook to see if the new `get_prediction` feels
like containing too many hoops that we have to jump through. We have
many plans for extensions, but it might become overkill for simple use
cases.

http://nbviewer.ipython.org/gist/josef-pkt/4c8d1f0eadf03375d8aa

PR is at https://github.com/statsmodels/statsmodels/pull/2151

I'm running currently low in my ability to come up with or decide on
good names, so the interface will be "experimental" in 0.7.

mean -> conditional_expectation
mean_se -> standard_error_of_conditional_expectation
....

only sometimes we reuse the code and then it might be something different.


----
The plan is to extend the prediction facilities in statsmodels 0.8.
The current version in PR is focused on the confidence interval and
setting up the structure.

predict as method stays simple so it can be used in a loop for example
for cross-validation without extra overhead. All additional predict
features will be added as a result instance of a new get_prediction
method.

The discussion for the design for enhancements is spread out over
several issues on github.

Josef

josef...@gmail.com

unread,
Feb 9, 2015, 1:38:26 PM2/9/15
to pystatsmodels
It's missing a nice plotting methods for fill_between confidence intervalls.

My 5 minute attempts are not pretty

see first plot in updated notebook
http://nbviewer.ipython.org/gist/josef-pkt/4c8d1f0eadf03375d8aa


Josef
Reply all
Reply to author
Forward
0 new messages