Skip to content

Instantly share code, notes, and snippets.

@MattHJensen
Last active January 27, 2016 17:23
Show Gist options
  • Save MattHJensen/5b1a9a7c0d81ff57ef7d to your computer and use it in GitHub Desktop.
Save MattHJensen/5b1a9a7c0d81ff57ef7d to your computer and use it in GitHub Desktop.
how I identified odd behavior in mtr()
import sys
sys.path.append("../../")
from taxcalc import *
import pandas as pd
import numpy as np
records_x = Records("../../puf.csv")
params_x = Policy()
records_y_std = Records("../../puf.csv")
params_y_std = Policy()
behavior_std = Behavior()
reform_std = {
2015: {
'_STD': [[12600, 25200, 12600, 18500, 25200, 6300, 1050]]
},}
params_y_std.implement_reform(reform_std)
calc_x = Calculator(params_x, records_x)
for i in range(4):
calc_x.increment_year()
assert calc_x.current_year == 2017
calc_y_std = Calculator(params_y_std, records_y_std, behavior = behavior_std)
for i in range(4):
calc_y_std.increment_year()
assert calc_x.current_year == 2017
calc_x.calc_all()
calc_y_std.calc_all()
x = pd.DataFrame()
x['_expanded_income'] = calc_x.records._expanded_income
a,b,x['mtr_x'] = calc_x.mtr()
a,b,x['mtr_y'] = calc_y_std.mtr()
x['_combined_x'] = calc_x.records._combined
x['_combined_y'] = calc_y_std.records._combined
x['mtr_diff'] = x['mtr_x'] - x['mtr_y']
x.sort('mtr_diff')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment