Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG/REF: redundant code in genmod get_prediction_glm, ignores link #7864

Open
josef-pkt opened this issue Nov 7, 2021 · 2 comments
Open

Comments

@josef-pkt
Copy link
Member

josef-pkt commented Nov 7, 2021

update It looks like there are some bugs, some options seem to be ignored,
e.g. I don't see any offset handling in the code for endpoint transformation confint, it just uses linpred = x b.
looks like false alarm
more in later comments

The get_prediction_glm function in genmod has weights handling copy pasted from regression linear model version.
weights are not used in GLM.
GLM and GLMResults predict do not support weights, no freq_weights or var_weights. Maybe those should be added.

The function needs exog everything else we could delegate to results predict instead of using model predict.
The exog need to go through transform handling.
In GAM we also need creating the basis function for the predict exog.

@josef-pkt
Copy link
Member Author

link argument is ignored, instead the attached model.family.link is used.

@josef-pkt josef-pkt changed the title REF: redundant code in genmod get_prediction_glm BUG/REF: redundant code in genmod get_prediction_glm, ignores link, ignores offset in confint Nov 9, 2021
@josef-pkt
Copy link
Member Author

offset handling, reading code

predicted mean looks correct it goes through model.predict with keywords
predicted_mean = self.model.predict(self.params, exog, **pred_kwds)
PredictionResults uses the linear prediction result only in EP confint

regression linear PredictionResult also goes through model.predict, so pred_kwds like offset are taken into account
predicted_mean = self.model.predict(self.params, exog, **pred_kwds)
confint for linpred is predicted mean +/- crit * std. So this is also correct.

So offset handling in get_prediction looks correct
I don't see unit tests for it.

@josef-pkt josef-pkt changed the title BUG/REF: redundant code in genmod get_prediction_glm, ignores link, ignores offset in confint BUG/REF: redundant code in genmod get_prediction_glm, ignores link Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant