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

IPTW diagnostics and MSM access #146

Open
pzivich opened this issue Sep 29, 2020 · 0 comments
Open

IPTW diagnostics and MSM access #146

pzivich opened this issue Sep 29, 2020 · 0 comments
Labels
Causal inference Updates for the causal inference branch enhancement

Comments

@pzivich
Copy link
Owner

pzivich commented Sep 29, 2020

A few items have come up regarding IPTW. One additional diagnostic plot to add is a weighted histogram for continuous variables. This way it can be visually assessed whether the densities are similar between the weighted population by treatment. In the mean time this can be accomplished via:

ipw = IPTW(data, exposure="A", outcome="Y")
ipw.treatment_model("L")
# Extracting the estimated IPTW from the IPTW class
data['iptw'] = ipw.iptw
# Subset by treatment status
treat = data.loc[data["A"] == 1].copy()
nottr = data.loc[data["A"] == 0].copy()
# Weighted histogram
plt.hist(treat['L'],  weights=treat['iptw'], color='blue', alpha=0.4)
plt.hist(nottr['L'],  weights=nottr['iptw'], color='red', alpha=0.4)
plt.show()

Next, IPTW should allow access to the fitted statsmodels objects. This way proportions (and the correct CL) can be calculated for any combination of interest to users. It is easier to have the statsmodels objects directly changed rather than building my own wrapper to extract any combination correctly (since it requires manipulation of the variance-covariance matrix). But may consider depending on user feedback

@pzivich pzivich added enhancement Causal inference Updates for the causal inference branch labels Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Causal inference Updates for the causal inference branch enhancement
Projects
None yet
Development

No branches or pull requests

1 participant