Skip to content

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

Open

Description

@josef-pkt

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.

Activity

  1. added this to the 0.14 milestone on Nov 7, 2021
  2. josef-pkt commented on Nov 7, 2021

    @josef-pkt
    MemberAuthor

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

  3. 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[/+] on Nov 9, 2021
  4. josef-pkt commented on Nov 9, 2021

    @josef-pkt
    MemberAuthor

    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.

  5. 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[/+] on Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions