Skip to content

get_margeff to GLM link=probit() and link=logit() #7341

Open

Description

@alekracicot

Is your feature request related to a problem? Please describe

I see that get_margeff is an available method for probit and logit regression. However, var_weights is not implemented for both logit and probit and therefore I need to use GLM and specify the correct family. The problem is that get_margeff is not available for get_GLMResults.

Describe the solution you'd like

Would it be possible to add the get_margeff method to GLM results?

Describe alternatives you have considered

Adding var_weights to logit and probit would also be awesome but i recall reading that it is a difficult thing to do.

Additional context

I searched the documentation a lot but I might have missed something. If so it would be very appreciated if someone pointed me in the right direction.

Thank you.
Alek

Activity

  1. josef-pkt commented on Feb 21, 2021

    @josef-pkt
    Member

    what's the interpretation of margins with var_weights?

    The margeff code of discrete can be reused for GLM but only without weights.
    Weights have not been added to all post-estimation features, even for GLM.

    I never looked at margins with any weights.
    Is there a reference or is it available in R, Stata, ...?

    #2849 has a comment that in Stata margins are not available with fweights
    #4751 issue to get margeff for GLM but without considering of weights. I don't remember what the status is.

  2. josef-pkt commented on Feb 21, 2021

    @josef-pkt
    Member

    If we can ignore weights for margeff, i.e. use them for estimation of parameters, but margins are just changes of predicted mean, then it should be possible to reuse discrete margins.

    I might have tried get_margeff with GLM already, but need to find my examples or code.

  3. alekracicot commented on Feb 21, 2021

    @alekracicot
    ContributorAuthor

    @josef-pkt sorry if my explanation is not clear English is not my first language, but for weights, I was referring to the stata command "aw=" or "pw" . It is equivalent to var_weights in GLM, but then I can't get the marginal effet to the mean or the average marginal effect.

    Thanks for the reply, i hope this clarifies my problem.

  4. josef-pkt commented on Feb 21, 2021

    @josef-pkt
    Member

    GLM is missing the derivatives required by margeff. I thought I had added them, but there are only the derivatives needed for influence measures.
    So margins will not work yet with GLM

    BTW: your English is fine, but it is often not clear to me how things are defined with additional options like weights.

  5. alekracicot commented on Feb 24, 2021

    @alekracicot
    ContributorAuthor

    Ok thanks a lot for your time.

  6. josef-pkt commented on May 19, 2023

    @josef-pkt
    Member

    #8889 adds get_margeff to GLM
    raises if offset is not None or missing
    warns if exposure, var_weights or freq_weights have been used. Those are (currently) ignored for margins.

  7. josef-pkt commented on May 22, 2023

    @josef-pkt
    Member

    #8517 (comment)
    including freq_weights is important only in average effect, "overall" in margeff, i.e. similar to agg_weights in get_prediction.
    For individual prediction assuming freq_weights = 1. will be more useful than using sampling freq_weight.

  8. josef-pkt commented on Jun 9, 2023

    @josef-pkt
    Member

    GLM get_margeff added in #8889
    raises if offset was used
    warns if exposure or weights were used

    freq_weights would be useful in "overall" and "at means"
    not for individual exog observations. (or force users to set freq_weights = 0 to skip usage of freq_weights.

    not clear yet if I want to change current margeff to include weights.
    maybe it is easier to use NonlinearDeltaCov directly.
    other option: add freq_weights in the derivative methods, so the margeff code does not have to handle it explicitly.

  9. added
    topic-post_estim
    on Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    comp-genmodtopic-post_estimtype-enh

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions