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
SUMM/ENH: margins, ATE and ATET for stratified contingency tables #2696
Agresti categorical data analysis, 2nd, 2003, section 2.3 on stratified 2x2xK tables
has good discussion on other explanatory (confounding) variables and Simpson's paradox
He doesn't mention (as far as I read) average treatment effect and average treatment effect on the treated.
AFAICT, this would be calculating a marginal table but not with observed frequencies along the confounder (K) dimension, but with marginal weights corresponding to population or treated.
i.e. the same what we would be doing in Logit/Binomial to calculate ATE (in parametric model)
addition
The more general issue is in how to handle frequency weights in the models for calculating Margins and POM (potential outcome mean). Instead of adjusting the exog for predict, we need to adjust the weights to calculate POM, assuming no unobserved confounders.
example: from Agresti 2003: 2x2x2x2 contingency table with seatbelt use, gender, location and injury. I'm using a GLM-Binomial example right now.
Qu. What would have been the injury proportion of women if they had the same seatbelt use and location as man, or the population average seatbelt use and location?
Qu. What's the ATE of seatbelt use, population averaged over confounders.
(This is similar to case in economics when we have a conditional individual effect and a composition effect. change in price versus change in quantities to get total expenditures)
Related: inverse probability weighting and survey weighting.
see also #2698 prediction in GLM-Binomial. If we have "exposure" or "fweights" as option in predict, then it would be easy to aggregate prediction with different weights.
I'm trying to do this with pandas, but it's getting tedious. I don't know what's a good way to implement this. (I'm additional comment about margins in descriptions)
changed the title [-]SUMM/ENH: ATE and ATET for stratified contingency tables[/-][+]SUMM/ENH: margins, ATE and ATET for stratified contingency tables[/+]on Nov 7, 2015
res_b.predict(exposure=np.log(df_injury_bin['total'].values))
-> ValueError: exposure can only be used with the log link function
But, maybe I'm thinking of the wrong thing. I was trying to calculate empirical decomposition effect, i.e. with actual frequencies. Instead, the model predict can aggregate over the entire population given a counterfactual everyone is female.
edit No, we cannot right now because GLM Binomial doesn't use weights in prediction and averaging probabilites without weights is useless, and we don't predict counts, see #2698
Activity
josef-pkt commentedon Nov 7, 2015
I'm trying to do this with pandas, but it's getting tedious. I don't know what's a good way to implement this. (I'm additional comment about margins in descriptions)
[-]SUMM/ENH: ATE and ATET for stratified contingency tables[/-][+]SUMM/ENH: margins, ATE and ATET for stratified contingency tables[/+]josef-pkt commentedon Nov 7, 2015
res_b.predict(exposure=np.log(df_injury_bin['total'].values))->
ValueError: exposure can only be used with the log link functionBut, maybe I'm thinking of the wrong thing. I was trying to calculate empirical decomposition effect, i.e. with actual frequencies. Instead, the model predict can aggregate over the entire population given a counterfactual everyone is female.
edit No, we cannot right now because GLM Binomial doesn't use weights in prediction and averaging probabilites without weights is useless, and we don't predict counts, see #2698