You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
get_margeff to GLM link=probit() and link=logit() #7341
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.
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.
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.
@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.
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.
#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.
#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.
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.
Activity
josef-pkt commentedon Feb 21, 2021
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.
josef-pkt commentedon Feb 21, 2021
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
discretemargins.I might have tried get_margeff with GLM already, but need to find my examples or code.
alekracicot commentedon Feb 21, 2021
@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.
josef-pkt commentedon Feb 21, 2021
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.
alekracicot commentedon Feb 24, 2021
Ok thanks a lot for your time.
josef-pkt commentedon May 19, 2023
#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.
josef-pkt commentedon May 22, 2023
#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.josef-pkt commentedon Jun 9, 2023
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.