Hi Vincent,
You can use model predict which takes `params` as the first argument.
The other difference is that model.predict expects exog to be an numpy array, while results predict can take a pandas DataFrame that is transformed with the formula in the same way as the training sample data.
> Background: I want to use numerical differentiation to get derivatives of predictions (and functions of) w.r.t. parameters, for some Delta Method applications. I'm exploring the possibility of porting my `marginaleffects` package for R to Python and `statsmodels`:
https://vincentarelbundock.github.io/marginaleffects/
That would be great. I looked at it and similar R packages in the last year.
I did most of the background implementation already, e.g. delta method for prediction is available through `_test_wald_nonlinear` which can take user provided functions.
It's currently used in get_prediction.
I have notebooks to illustrate how to use it for computing predictive margins and marginal/partial effects (with some unit tests against get_margeff)
The two main missing pieces
- creating "interesting" exog, sets of explanatory variables that can be used in predict. (I showed some of my experiments with pandas in an earlier comment in the mailing list)
- figuring out terms in the formulas and their derivative, e.g. interaction effects, or polynomials and similar
My notebooks are not published, so I have to look for them