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

[BUG] rake doesn't support trimming - but also doesn't indicate it to the user #69

Open
talgalili opened this issue Jan 22, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@talgalili
Copy link
Contributor

This is violating user expectation.

E.g.:

weights_untrimmed = sample.adjust(
    variables=weighting_variables,
    method="rake",
    weight_trimming_mean_ratio=0,
    transformations=auto_recodes,
)

By expectation violation I mean,

  1. there isn’t anything in the docs that suggests that rake doesn’t support weight_trimming_mean_ratio or weight_trimming_percentile
  2. there isn’t an error thrown when a value is passed to either weight_trimming_mean_ratio or weight_trimming_percentile suggesting that rake doesn’t support it.
  3. this can result people thinking the weights are getting trimmed when they aren’t.

(Reported by David Lovis-McMahon)

@talgalili talgalili added the bug Something isn't working label Jan 22, 2024
@talgalili
Copy link
Contributor Author

This issue also happens for post stratification.
The locations of the functions to fix:


We might need to add it here:

# rescale weights to sum to target_sum_weights (sum of initial target weights)

As opposed to how it's solved for, say, CBPS:

weights = balance_adjustment.trim_weights(

And ipw
weights = balance_adjustment.trim_weights(

Since there is always also the stage of normalizing the sum of weights of target population, it might be more easily solved as a new function that trims and normalize to sum of weights of the target.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant