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

Add UBI to benefits totals #2418

Merged
merged 8 commits into from
Jun 19, 2020
Merged

Add UBI to benefits totals #2418

merged 8 commits into from
Jun 19, 2020

Conversation

jdebacker
Copy link
Member

This PR updates the computation of benefits totals to include UBI program benefits.

@codecov
Copy link

codecov bot commented Jun 16, 2020

Codecov Report

Merging #2418 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2418   +/-   ##
=======================================
  Coverage   99.92%   99.92%           
=======================================
  Files          13       13           
  Lines        2554     2560    +6     
=======================================
+ Hits         2552     2558    +6     
  Misses          2        2           
Impacted Files Coverage Δ
taxcalc/calculator.py 100.00% <100.00%> (ø)
taxcalc/utils.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cbaee03...4ce36e4. Read the comment docs.

@jdebacker
Copy link
Member Author

This is ready for review @Peter-Metz @MattHJensen.

Note, I'm assuming we don't need a consumption benefits scale parameter for UBI since it's a cash transfer.

@jdebacker jdebacker changed the title [WIP] Add UBI to benefits totals Add UBI to benefits totals Jun 16, 2020
@Peter-Metz
Copy link
Contributor

@jdebacker, thanks a lot for the PR. It looks like benefit_value_total and benefit_cost_total aren't getting updated with the new implementation because the BenefitPrograms() function is using an array of zeros for UBI, as opposed to the calculated amounts. The easiest solution I could come up with is to add a few lines to _calc_one_year() which is called during calc_all():

benefit_value_total_ubi = self.array('ubi') + self.array('benefit_value_total')
self.array('benefit_value_total', benefit_value_total_ubi)
benefit_cost_total_ubi = self.array('ubi') + self.array('benefit_cost_total')
self.array('benefit_cost_total', benefit_cost_total_ubi)

This solution feels a little hardcoded, but we wouldn't have to modify calcfunctions.py.

Also, to avoid double counting when calculating expanded income, we need to remove this line.

Finally, I was looking at the three Tax-Calc tables -- difference, distribution, and diagnostic -- and it looks like the first two have line items for UBI and benefits totals. We might want to consider adding those variables to the diagnostic table as well.

@jdebacker
Copy link
Member Author

@Peter-Metz Thanks for those comments. Changing this to a WIP while I resolve those issues you raise.

@jdebacker jdebacker changed the title Add UBI to benefits totals [WIP] Add UBI to benefits totals Jun 17, 2020
@jdebacker
Copy link
Member Author

@Peter-Metz Can you review and see that my latest commits address the issues you raise about computing UBI for benefits totals and adding to the diagnostic tables. Thanks!

@jdebacker
Copy link
Member Author

Also, @Peter-Metz, can you share code you used to find that benefit_value_total and benefit_cost_total aren't getting updated? I could add that as a test.

@Peter-Metz
Copy link
Contributor

Hey @jdebacker, these latest changes look good to me at first glance, but I'll take a closer look tomorrow. Here's how I tested if benefits_cost_total is getting updated:

from taxcalc import *

ubi_ref = {'UBI_21': {2020: 1000}}    

pol = Policy()                                                                             
recs = Records()                                                                           
calc_base = Calculator(pol, recs) 
calc_base.advance_to_year(2020)                                                                
calc_base.calc_all()
                                                          
pol_ubi = Policy()                                                                            
pol_ubi.implement_reform(ubi_ref)
calc_ubi = Calculator(pol_ubi, recs)                                                                                                                      
calc_ubi.advance_to_year(2020)                                                               
calc_ubi.calc_all()

(calc_ubi.weighted_total('ubi') - calc_base.weighted_total('ubi'))/1e9
### 241.02410248

(calc_ubi.weighted_total('benefit_cost_total') - calc_base.weighted_total('benefit_cost_total'))/1e9  
### 0.0     

@jdebacker
Copy link
Member Author

Thanks @Peter-Metz. Just added a test that confirms UBI is included in the benefits totals coming out of Calculator.calc_all() as you laid it out.

@jdebacker jdebacker changed the title [WIP] Add UBI to benefits totals Add UBI to benefits totals Jun 17, 2020
@Peter-Metz
Copy link
Contributor

@jdebacker all looks good to me, thanks again for the PR. I'll leave this open for @MattHJensen to review and merge.

@MattHJensen
Copy link
Contributor

Thanks a lot for the PR, @jdebacker and review @Peter-Metz. This looks good to me, too. Merging.

@MattHJensen MattHJensen merged commit f3f7d95 into PSLmodels:master Jun 19, 2020
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