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

use unweighted variance for denominator for weighted smd #14

Merged
merged 9 commits into from
May 1, 2024

Conversation

nuvanrath
Copy link
Contributor

@bsaul, I've been thinking more about SMDs and came across this note in the documentation for Noah Greifer's cobalt package, citing a couple papers by Elizabeth Stuart:

A key detail is that the standard deviation, no matter how it is computed, is always computed using the unadjusted sample. This is line with how MatchIt computes standardized mean differences, and is recommended by Stuart (2008, 2010). One reason to favor the use of the standard deviation of the unadjusted sample is that it prevents the paradoxical situation that occurs when adjustment decreases both the mean difference and the spread of the sample, yielding a larger standardized mean difference than that prior to adjustment, even though the adjusted groups are now more similar. By using the same standard deviation before and after adjusting, the change in balance is isolated to the change in mean difference, rather than being conflated with an accompanying change in spread.

I've made minor tweaks so that the unadjusted variance is used as the denominator in n_mean_var. This would be a breaking change, though how often and how much the results would change is unclear to me. I suppose this could also be an argument, whether the user wants the unadjusted or adjusted variance as the denominator. Let me know what you think

@bsaul
Copy link
Owner

bsaul commented Apr 4, 2024

I don't have opinions on this TBH. Do other users? @ddsjoberg @asb2111.

@asb2111
Copy link
Contributor

asb2111 commented Apr 4, 2024

I like the idea of making it an option. I agree with the argument from Griefer and Stuart, but I can also imagine cases where you aren’t specifically looking to compare before/after weighting, for instance if the weights are just case weights.

@bsaul
Copy link
Owner

bsaul commented Apr 5, 2024

Yeah, if we're to include unweighted variance, it should be an option -- it's not clear to me the best UI for that option.

@nuvanrath
Copy link
Contributor Author

Good call! I've taken an initial stab at adding this argument to smd with the default being to use the unweighted variance. I'll add in tests to cover this change in the next few days.

@nuvanrath
Copy link
Contributor Author

Well, life happened, but I have finally added in some tests of the weighted and unweighted variances. Let me know what you think.

@bsaul
Copy link
Owner

bsaul commented Apr 24, 2024

@nuvanrath - The changes here seem enough to me to bump version to 0.7.0.

@bsaul bsaul merged commit e6a993b into bsaul:master May 1, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants