Allow population (rather than filing-unit) quantiles in tables and graphs #2322
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request resolves issue #2310 by adding an optional
pop_quantiles
argument to all the Tax-Calculator table and graph methods that allow using quantiles for distributional analysis. As @MaxGhenis pointed out in issue #2310, both CBO and TPC use quantiles that contain equal numbers of people (not equal numbers of filing units). And, if you read the cited CBO document, you will see that both CBO and TPC also adjust the incomes of filing units by the square root of the number of people in the filing unit before they sort filing units by income. Setting the new optionalpop_quantiles
argument to True also does this unit-size adjustment of incomes.The new optional
pop_quantiles
argument always has a default value of False, so that backward compatibility is maintained. But when doing Python programming, you have the option of setting it to True.Implementing this seemingly simple enhancement request required considerable changes in low-level logic. Most, if not all, users will not be affected by the low-level changes: a few column names in the distributional tables have been changed, and the Calculator
distribution_table_dataframe
method has been integrated into the Calculatordistribution_tables
method making it easier to generate distribution tables. If you are using the low-levelcreate_*_tables
utility functions (rather than the high-levelCalculator.*_tables
methods, then you should review your application's operation when upgrading to the Tax-Calculator release that contains this pull request. Also, in the course of making these changes, a (never reported) bug in the difference table was found and corrected. Previously, the values oftax_cut
andtax_inc
were understated by a large factor in difference tables; now they are scaled correctly to the number of filing units (or people) expressed in millions.A number of new tests have been added to check the new table logic and all seems well. But if you notice any unexpected changes in the contents of distribution or difference tables, please raise an issue.