Repository navigation
Prediction interval - #2151
Prediction interval#2151
Conversation
|
still need OrderedDict from compat for python 2.6 |
e55ee1d to
7e4b9a6
Compare
666cd19 to
080ad67
Compare
|
This will be extremely useful to me. Among other applications, when using b-splines in a regression fit, it is nearly always useful to plot the predicted value against the covariate to see what the fitted functional form is. This will make that much easier than it currently is. One thing that would make it even more useful is to have the option to only partially specify the exog data at which the predictions are made. Unspecified variables would be automatically set to the mean or some other functional of the marginal distribution of that covariate in the training data. I think this is something like the behavior of "at" in Stata margins, but for the usual predictions conditioned on all covariates. |
|
@kshedden Thanks for the comments. Any comment on interface, namings? I'd like to merge this PR relatively soon, without adding many extra features now, but setting up the code in a way that it can be extended without breaking backwards compatibility (much). I opened other issues, mainly the margin review #2154 for the |
There was a problem hiding this comment.
I think our convention is (going to be) mean_se we have effect_se somewhere
similar obs_se, obs is not really good, but I don't know an alternative
|
I'd like to get this merged for 0.7 I expect this will become popular soon as replacement for the sandbox function, and we need to get the interface stable fast. ??? |
|
I didn't read the code carefully, but I was just thinking about the scope of what a "predict" should do. It seems like the idea is to support most forms of post-estimation inference for fitted conditional means or new observed responses (but not post-estimation inference for parameters and inference for the model structure). As such, "predict" is sort of a misnomer because it suggests exclusively the setting where the target is a (random) observation. But it's conventional due to R to call it "predict". Thus the scope for "prediction" includes point estimation/prediction, standard errors, tests, and intervals for the estimated/predicted values (no tests for predicted values). All this seems to be covered here. Everything should work seamlessly for either model.exog or a new exog. This seems to be handled well here. Other things I like that aren't here yet:
|
|
I pretty much agree with the requirements and wishlist. I opened several issues for individual pieces when I was working on this PR. Stata distinguishes Our t_test is already vectorized and can be used for linear prediction. When we have a More discussion about the general design and requirements should be in the SUMMary issue #2150 so it doesn't get lost in the comments of a closed PR. |
080ad67 to
67f5635
Compare
|
rebased and force pushed I have a notebook that shows that it's reasonably easy to work with this |
adding
get_predictionto linear_model RegressionResultseverything is written in standalone function for reuse in other models, but some things are linear model specific. (It's not a generic function.)
main issue for regression.linear model #719
also several discussions on mailing list
SUMMary issue for extension to other models #2150
some implementation discussion for wrapping #2145
Status
so far mainly the basic outline, I'm trying to get that settled first
I didn't check much of the details yet.
unit test against old sandbox function.
now also method for GLM with link handling, conf_int is endpoint-transformation, see #938
PR also contains
statsmodels.genmod._prediction.params_transform_univariate, currently as a helper function for simple non-linear predictionuseful for #2235 add
eformfor exponentiated parameters