PSLmodels / InverseOptimalTax

Inverse optimal taxation model
https://pslmodels.github.io/InverseOptimalTax/
1 stars 3 forks source link

Add additional tests, approximate distributions from raw data #22

Closed jdebacker closed 10 months ago

jdebacker commented 10 months ago

This PR adds some additional unit test, including one to compare the computational solution to an analytical one.

It also removes the binning of the raw data by income group and rather uses the raw data directly to approximate the income distribution (which should resolve Issue #16).

jdebacker commented 10 months ago

@john-p-ryan In this PR I'm trying to move away from the binning of data by income group and rather approximate the earnings distribution and the MTR schedule directly from the raw data. This helps avoid zero weight bins.

The approximation of the population distribution seems to go quite well (although it doesn't exactly match the theoretical moments at all points in the distribution, it is close). But the approximation of the MTR schedule has proven more challenging. Fitting a spline function to the whole distribution often takes several minutes and it's seems tricky to get the smoothing parameter just right - either theirs too much noise or important curvature in the MTR schedule is missed.

codecov-commenter commented 10 months ago

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (fc84d50) 90.24% compared to head (529b07f) 81.81%. Report is 2 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #22 +/- ## ========================================== - Coverage 90.24% 81.81% -8.43% ========================================== Files 3 3 Lines 123 88 -35 ========================================== - Hits 111 72 -39 - Misses 12 16 +4 ``` | [Flag](https://app.codecov.io/gh/PSLmodels/InverseOptimalTax/pull/22/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/PSLmodels/InverseOptimalTax/pull/22/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels) | `81.81% <76.92%> (-8.43%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/PSLmodels/InverseOptimalTax/pull/22?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels) | Coverage Δ | | |---|---|---| | [iot/tests/test\_inverse\_optimal\_tax.py](https://app.codecov.io/gh/PSLmodels/InverseOptimalTax/pull/22?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels#diff-aW90L3Rlc3RzL3Rlc3RfaW52ZXJzZV9vcHRpbWFsX3RheC5weQ==) | `100.00% <100.00%> (ø)` | | | [iot/inverse\_optimal\_tax.py](https://app.codecov.io/gh/PSLmodels/InverseOptimalTax/pull/22?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels#diff-aW90L2ludmVyc2Vfb3B0aW1hbF90YXgucHk=) | `83.87% <75.67%> (-4.81%)` | :arrow_down: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.