diff --git a/cps_stage1/stage1.py b/cps_stage1/stage1.py index ee093b2c..82a3c498 100644 --- a/cps_stage1/stage1.py +++ b/cps_stage1/stage1.py @@ -6,7 +6,7 @@ def main(syr=2014): SYR = str(syr) # Start year of CPS - EYR = 2033 # Last year in our extrapolation + EYR = 2034 # Last year in our extrapolation # Read in state SOI estimates soi_estimates = pd.read_csv( diff --git a/cps_stage1/stage_2_targets.csv b/cps_stage1/stage_2_targets.csv index 25f7f81e..fc3d5ac7 100644 --- a/cps_stage1/stage_2_targets.csv +++ b/cps_stage1/stage_2_targets.csv @@ -1,24 +1,24 @@ -,2014,2015,2016,2017,2015,2016,2017,2018,2019,2020,2021,2022,2023,2024,2025,2026,2027,2028,2029,2030,2031,2032,2033 -Single,69579590,71086947,71410690,73021932,72028792,71924422,73183813,74331876,75333822,76224441,77122018,77984804,78861507,79745168,80635787,81540322,82451814,83377223,84309589,85248914,86209112,87169310,88150383 -Joint,55128595,57272012,57201828,57987204,57069122,56986429,57984256,58893878,59687730,60393376,61104535,61788129,62482750,63182883,63888529,64605200,65327385,66060595,66799319,67543555,68304329,69065104,69842417 -HH,22077498,22134303,21659639,21894095,22854626,22821510,23221112,23585391,23903307,24185899,24470699,24744460,25022636,25303020,25585612,25872620,26161835,26455466,26751304,27049351,27354020,27658689,27969982 -SS_return,27401498,28087514,28329015,28967603,31684352,32736570,33818929,34953351,36139836,37386604,38614191,39891101,41154310,42384637,43664287,44875433,46007115,47097695,48141692,49089784,49843325,50509181,51128455 -Dep_return,96916673,96505181,94809260,94708629,99911398,100735190,101549290,102373082,103187182,104001282,104805690,105610099,106414507,107209224,107984557,108759890,109525532,110281482,111018049,111744924,112452416,113150216,113828632 -INTS,156367939,95881223,96640233,106055367,124828526,125813644,138072890,143545768,146829495,146407301,147423693,155851925,184373437,200807707,208407189,223277780,238382923,250517075,260993727,271798752,282244130,293189886,305105123 -DIVS,254702232,260252720,254065327,282336042,340613295,332513764,369521998,401130545,421201081,463481652,494147800,519032208,531334326,529525940,539612149,558944048,583064349,608228930,632425642,657106288,682347280,708148616,734484826 -SCHCI,374659000,391975736,389078638,416010104,435503622,432281554,462216808,485895257,491852335,503691560,536549154,552846820,573190804,600728241,631525210,664682532,696940672,729461073,762580929,796037977,829794753,864188449,898844407 -SCHCL,57400238,60161435,60996610,69637956,63668344,64552308,73696166,77467361,78425945,80308673,85549315,88149545,91386919,95783777,100691497,105978059,111121121,116304362,121585184,126917666,132301809,137783531,143311174 -CGNS,705007630,713598090,634341278,859894631,1249696525,1110880523,1505896298,1631599158,1522675479,1983609468,3514815539,2928178690,2558331688,2358673527,2262087482,2213653457,2207308389,2227189604,2268291549,2325538168,2393782907,2470135233,2552409624 -Pension,663223262,689991999,693626543,729187412,776568117,800178866,846471849,889515039,925594384,996293984,1069779122,1093456192,1161502899,1215621917,1267154364,1326247557,1384478559,1444102331,1504588292,1567660824,1632258770,1700769733,1770474498 -SCHEI,846331543,891134646,882933054,973306129,1140431754,1129937243,1245546132,1348629314,1385360103,1322308403,1621317337,1711451646,1505793081,1517895622,1677005952,1790752912,1894259260,1968482536,2033988597,2104657281,2178795924,2258943521,2339006485 -SCHEL,166947674,177896945,176446339,206369393,169401805,168032834,196514107,212774811,218567895,208634508,255797226,270021168,237566540,239486438,264595369,282542243,298869726,310572758,320906819,332058924,343761956,356399894,369021139 -SS,575126918,605152093,619856114,644989570,709246515,726500323,755946821,795975655,848657280,898463271,939067232,1016191751,1097687236,1171648557,1244919727,1322159272,1402216939,1488255926,1577285573,1668903291,1762879029,1762879029,1762879029 -UCOMP,33288898,27225383,25420264,23946035,9810238,9161105,8628482,7962704,7490002,7746327,66767543,10193061,7633144,8711705,9410771,10239665,11098519,12097186,12882804,13372150,13824879,14211031,14211031 -wage1,114320683,112017897,111270085,107376379,132211870,134189618,140763057,147839507,154870229,157088051,170920853,185370987,194653827,203902370,213848270,223108245,231648000,240542149,249802124,259302173,269030863,278908170,288934094 -wage2,261995646,261659142,253415638,247511878,302997965,307530489,322595239,338812769,354925502,360008217,391709690,424825940,446099986,467295434,490089055,511310703,530881777,551265039,572486686,594258524,616554354,639190778,662167796 -wage3,381259619,383184602,382875414,382789227,440926749,447522541,469444969,493044939,516492406,523888842,570021256,618212472,649170753,680014656,713184243,744066272,772546366,802208364,833090393,864773068,897218261,930159092,963595561 -wage4,418567676,428313928,436140082,441282302,484073517,491314738,515382379,541291719,567033631,575153844,625800532,678707487,712695182,746557307,782972695,816876676,848143682,880708247,914612229,949395203,985015312,1021179559,1057887944 -wage5,418379915,424369612,426147995,437485582,483856372,491094344,515151189,541048906,566779271,574895841,625519811,678403032,712375481,746222416,782621469,816510242,847763222,880313179,914201952,948969323,984573454,1020721479,1057413397 -wage6,916618937,952347137,962308451,1000500360,1060069801,1075927308,1128632897,1185371609,1241743674,1259526081,1370436973,1486297606,1560727064,1634881536,1714627384,1788873517,1857344952,1928657905,2002904039,2079075073,2157079344,2236275221,2316662701 -wage7,840581301,835434509,852517230,870406373,972132275,986674331,1035007756,1087039738,1138735488,1155042766,1256753103,1363002580,1431257781,1499260808,1572391382,1640478467,1703269890,1768667115,1836754201,1906606507,1978139976,2050766200,2124485180 -wage8,3433224075,3714896131,3792750634,4090211841,3970523643,4029918419,4227328804,4439845374,4650988654,4717593201,5133013315,5566972838,5845750633,6123498460,6422188955,6700280105,6956741943,7223846776,7501937926,7787238847,8079406216,8376036776,8677130527 +,2014,2015,2016,2017,2015,2016,2017,2018,2019,2020,2021,2022,2023,2024,2025,2026,2027,2028,2029,2030,2031,2032,2033,2034 +Single,69579590,71086947,71410690,73021932,72028792,71924422,73183813,74331876,75333822,76224441,77122018,77984804,78861507,79745168,80635787,81540322,82451814,83377223,84309589,85248914,86209112,87169310,88150383,89131455 +Joint,55128595,57272012,57201828,57987204,57069122,56986429,57984256,58893878,59687730,60393376,61104535,61788129,62482750,63182883,63888529,64605200,65327385,66060595,66799319,67543555,68304329,69065104,69842417,70619730 +HH,22077498,22134303,21659639,21894095,22854626,22821510,23221112,23585391,23903307,24185899,24470699,24744460,25022636,25303020,25585612,25872620,26161835,26455466,26751304,27049351,27354020,27658689,27969982,28281275 +SS_return,27401498,28087514,28329015,28967603,31684352,32736570,33818929,34953351,36139836,37386604,38614191,39891101,41154310,42384637,43664287,44875433,46007115,47097695,48141692,49089784,49843325,50509181,51128455,51758690 +Dep_return,96916673,96505181,94809260,94708629,99911398,100735190,101549290,102373082,103187182,104001282,104805690,105610099,106414507,107209224,107984557,108759890,109525532,110281482,111018049,111744924,112452416,113150216,113828632,114487666 +INTS,156367939,95881223,96640233,106055367,124828526,125813644,138072890,143545768,146829495,146407301,147423693,155851925,161152798,187688437,206390043,228281554,245200565,259414411,269015402,280789908,293643353,307325547,318959322,329498521 +DIVS,254702232,260252720,254065327,282336042,340613295,332513764,369521998,401130545,421201081,463481652,494147800,519032208,589253614,607337472,627255187,644269296,657411931,676208956,702570637,730460531,759190943,788812813,819300670,850603574 +SCHCI,374659000,391975736,389078638,416010104,435503622,432281554,462216808,485895257,491852335,503691560,536549154,552846820,564386318,591174436,617887623,645837184,672587837,698626637,725002631,752053011,780452163,810687144,843245011,876364867 +SCHCL,57400238,60161435,60996610,69637956,63668344,64552308,73696166,77467361,78425945,80308673,85549315,88149545,89986353,94251191,98516028,102970287,107235125,111385162,115592599,119909097,124437976,129253856,134448577,139723659 +CGNS,705007630,713598090,634341278,859894631,1249696525,1110880523,1505896298,1631599158,1522675479,1983609468,3582355270,2279853674,2417823667,2270900077,2235790697,2184818645,2186369662,2221620044,2278866663,2350072434,2430795807,2518569257,2611700765,2709062319 +Pension,663223262,689991999,693626543,729187412,776568117,800178866,846471849,889515039,925594384,996293984,1069779122,1093456192,1156992981,1219534934,1278031226,1337787642,1397212446,1458626920,1521102551,1586827977,1654941006,1725839572,1798329875,1872743525 +SCHEI,846331543,891134646,882933054,973306129,1140431754,1129937243,1245546132,1348629314,1385360103,1322308403,1621317337,1711451646,1881479653,1909154695,1962219682,2005382591,2054977620,2118791018,2192845028,2260551551,2331050969,2411198566,2493885158,2582834603 +SCHEL,166947674,177896945,176446339,206369393,169401805,168032834,196514107,212774811,218567895,208634508,255797226,270021168,296849659,301206993,309587767,316399232,324229078,334279328,345982360,356650316,367785726,380423665,393462278,407502577 +SS,575126918,605152093,619856114,644989570,709246515,726500323,755946821,795975655,848657280,898463271,939067232,1016191751,1138003633,1234049828,1311634449,1389794197,1470139428,1555315724,1643310143,1733317505,1824417609,1916150353,2012484111,2113648936 +UCOMP,33288898,27225383,25420264,23946035,9810238,9161105,8628482,7962704,7490002,7746327,66767543,10193061,7633144,10209705,11790928,12207039,12762963,13318888,13928075,14537262,15093186,15565889,16008631,16481333 +wage1,114320683,112017897,111270085,107376379,132211870,134189618,140763057,147839507,154870229,157088051,170920853,185370987,196128564,205571452,215128661,224468661,233637180,243022908,252808758,262914707,273260729,283789663,294478647,305339112 +wage2,261995646,261659142,253415638,247511878,302997965,307530489,322595239,338812769,354925502,360008217,391709690,424825940,449479730,471120571,493023407,514428451,535440502,556950344,579377172,602537587,626248193,650377992,674874585,699764171 +wage3,381259619,383184602,382875414,382789227,440926749,447522541,469444969,493044939,516492406,523888842,570021256,618212472,654089002,685581047,717454351,748603262,779180283,810481698,843117521,876820872,911324867,946438878,982086653,1018306316 +wage4,418567676,428313928,436140082,441282302,484073517,491314738,515382379,541291719,567033631,575153844,625800532,678707487,718094705,752668395,787660653,821857632,855426759,889791166,925620559,962621941,1000502316,1039052399,1078188477,1117952406 +wage5,418379915,424369612,426147995,437485582,483856372,491094344,515151189,541048906,566779271,574895841,625519811,678403032,717772582,752330763,787307324,821488963,855043032,889392023,925205344,962190129,1000053511,1038586301,1077704823,1117450915 +wage6,916618937,952347137,962308451,1000500360,1060069801,1075927308,1128632897,1185371609,1241743674,1259526081,1370436973,1486297606,1572551448,1648264173,1724893516,1799781283,1873294122,1948548536,2027011117,2108040231,2190994245,2275414849,2361118720,2448197519 +wage7,840581301,835434509,852517230,870406373,972132275,986674331,1035007756,1087039738,1138735488,1155042766,1256753103,1363002580,1442101280,1511533295,1581805892,1650481385,1717896005,1786907730,1858861489,1933168876,2009241484,2086659022,2165253373,2245108597 +wage8,3433224075,3714896131,3792750634,4090211841,3970523643,4029918419,4227328804,4439845374,4650988654,4717593201,5133013315,5566972838,5890039223,6173623532,6460641064,6741135471,7016480042,7298347739,7592231719,7895728728,8206435506,8522635444,8843641895,9169798182 diff --git a/cps_stage2/cps_weights.csv.gz b/cps_stage2/cps_weights.csv.gz index b4385cee..c28b0251 100644 Binary files a/cps_stage2/cps_weights.csv.gz and b/cps_stage2/cps_weights.csv.gz differ diff --git a/cps_stage2/solver.jl b/cps_stage2/solver.jl index 78f2f7fd..3c1ade9b 100644 --- a/cps_stage2/solver.jl +++ b/cps_stage2/solver.jl @@ -80,7 +80,7 @@ function Solve_func(year, tol) end -year_list = [x for x in 2014:2033] +year_list = [x for x in 2014:2034] tol = 0.70 # Run solver function for all years and tolerances (in order) diff --git a/cps_stage2/stage2.py b/cps_stage2/stage2.py index 525a2cec..562a8849 100644 --- a/cps_stage2/stage2.py +++ b/cps_stage2/stage2.py @@ -11,7 +11,7 @@ STAGE_1_PATH = Path(CUR_PATH, "..", "puf_stage1", "Stage_I_factors.csv") STAGE_2_PATH = Path(CUR_PATH, "..", "cps_stage1", "stage_2_targets.csv") START_YEAR = 2014 -END_YEAR = 2033 +END_YEAR = 2034 # Read hashes used to see which years can be skipped with open(Path(CUR_PATH, "..", "datahashes.json")) as f: diff --git a/docs/book/content/methods/CBO_Baseline_Updating_Instructions.md b/docs/book/content/methods/CBO_Baseline_Updating_Instructions.md index 37c3eb4e..95d4b4f2 100644 --- a/docs/book/content/methods/CBO_Baseline_Updating_Instructions.md +++ b/docs/book/content/methods/CBO_Baseline_Updating_Instructions.md @@ -47,9 +47,9 @@ As previously mentioned, most of the variables we used can be found in the To manually update these variables download the latest file and copy/paste the specific variables. -Previous Document: May 2022 +Previous Document: February 2023 -Current Document: February 2023 +Current Document: February 2024 | Variable | Name In CBO Document | |----------|-----------------------------------------------------| @@ -70,9 +70,9 @@ Current Document: February 2023 Source: [Revenue Projections, By Category (CBO)](https://www.cbo.gov/about/products/budget-economic-data#7) -Previous: [February 2023](https://www.cbo.gov/system/files/2023-02/51138-2023-02-Revenue.xlsx) +Previous: [February 2024](https://www.cbo.gov/system/files/2024-02/51138-2024-02-Revenue.xlsx) -Current: [February 2023](https://www.cbo.gov/system/files/2023-02/51138-2023-02-Revenue.xlsx) +Current: [February 2024](https://www.cbo.gov/system/files/2024-02/51138-2024-02-Revenue.xlsx) In the revenue projections file, the data is in the `Capital Gains Realizations` tab under the `Capital Gains Realizations` column. @@ -81,9 +81,9 @@ tab under the `Capital Gains Realizations` column. Source: [IRS Publication 6187 Table 1B](https://www.irs.gov/statistics/projections-of-federal-tax-return-filings) -Previous: [Fall 2021 Report](https://www.irs.gov/pub/irs-soi/21projpub6187tables.xls) +Previous: [Fall 2022 Report](https://www.irs.gov/pub/irs-soi/22projpub6187tables.xlsx) -Current: [Fall 2022 Report](https://www.irs.gov/pub/irs-soi/22projpub6187tables.xlsx) +Current: [Fall 2023 Report](https://www.irs.gov/pub/irs-soi/23projpub6187tables.xlsx) The projections in the publication typically end a few years before the 10-year projections do. We use the growth rate from the final year in the @@ -96,9 +96,9 @@ Source: [OASI Trust Fund Annual Trustees Report](https://www.ssa.gov/oact/TR/) Table VI.C4. Operations of the OASI Trust Fund, Table VI.C4, Column: `Scheduled Benefits: Intermediate Level` -Previous: [2019 Report](https://www.ssa.gov/oact/TR/2019/tr2019.pdf) +Previous: [2023 Report](https://www.ssa.gov/oact/TR/2023/VI_C_SRfyproj.html) -Current: [2020 Report](https://www.ssa.gov/oact/TR/2020/VI_C_SRfyproj.html) +Current: [2023 Report](https://www.ssa.gov/oact/TR/2023/VI_C_SRfyproj.html) Projections are taken directly from the `Scheduled Benefits: Intermediate Level` column of this table. @@ -108,7 +108,7 @@ column of this table. Source: [BLS Database](http://data.bls.gov/timeseries/CUSR0000SAM?output_view=pct_1mth) Series ID: CUSR0000SAM -Access Date: March 07 2023 +Access Date: Manual Instructions: @@ -124,9 +124,9 @@ Manual Instructions: Source: [CBO Unemployment Compensation projections](https://www.cbo.gov/about/products/baseline-projections-selected-programs#24) -Previous: [March 2020](https://www.cbo.gov/system/files/2020-03/51316-2020-03-unemployment.pdf) +Previous: [February 2024](https://www.cbo.gov/system/files/2024-02/51316-2024-02-unemployment.xlsx) -Current: [May 2022](https://www.cbo.gov/system/files/2022-05/51316-2022-05-unemployment.xlsx) +Current: [February 2024](https://www.cbo.gov/system/files/2024-02/51316-2024-02-unemployment.xlsx) Note: Change the `Total Benefits` number from the table to be in terms of billions rather than millions of dollars diff --git a/environment.yml b/environment.yml index 18152574..d21396f8 100644 --- a/environment.yml +++ b/environment.yml @@ -21,7 +21,7 @@ dependencies: - python-chromedriver-binary - tabulate - pre-commit -- taxcalc>=3.0.0 +- taxcalc>=3.5.0 - pip - pip: - requests-html diff --git a/history/report.py b/history/report.py index bad84642..d51cf3b6 100644 --- a/history/report.py +++ b/history/report.py @@ -2,11 +2,11 @@ Script used to automatically generate PDF report comparing TaxData outputs after updates """ + # flake8: noqa: E501 import argparse import pandas as pd import taxcalc as tc -import altair as alt from report_utils import ( run_calc, distplot, @@ -135,7 +135,7 @@ def report(): continue chart = cbo_bar_chart(cbo_data, col, CBO_LABELS[col]) img_path = Path(CUR_PATH, f"{col}.png") - chart.save(str(img_path)) + chart.write_image(str(img_path)) plot_paths.append(img_path) cbo_projections.append(f"![]({str(img_path)})" + "{.center}") template_args["cbo_projections"] = cbo_projections @@ -166,25 +166,16 @@ def report(): new_grow["Growth Factors"] = "New" cur_grow["Growth Factors"] = "Current" growth_data = pd.concat([new_grow, cur_grow]) - rows = list(growth_data.columns) - rows.remove("YEAR"), - rows.remove("Growth Factors") - n = len(rows) // 3 - chart1 = growth_scatter_plot(growth_data, rows[:n]) - img_path = Path(CUR_PATH, "growth_factors1.png") - chart1.save(str(img_path)) - plot_paths.append(img_path) - growth_rate_projections.append(f"![]({str(img_path)})" + "{.center}") - chart2 = growth_scatter_plot(growth_data, rows[n : 2 * n]) - img_path = Path(CUR_PATH, "growth_factors2.png") - chart2.save(str(img_path)) - plot_paths.append(img_path) - growth_rate_projections.append(f"![]({str(img_path)})" + "{.center}") - chart3 = growth_scatter_plot(growth_data, rows[2 * n :]) - img_path = Path(CUR_PATH, "growth_factors3.png") - chart3.save(str(img_path)) - plot_paths.append(img_path) - growth_rate_projections.append(f"![]({str(img_path)})" + "{.center}") + growth_list = list(cur_grow.columns) + growth_list.remove("YEAR") + growth_list.remove("Growth Factors") + for var in growth_list: + plot = growth_scatter_plot(growth_data, var) + img_path = Path(CUR_PATH, f"{var}.png") + plot.write_image(str(img_path)) + plot_paths.append(img_path) + growth_rate_projections.append(f"![]({str(img_path)})" + "{.center}") + template_args["growth_rate_projections"] = growth_rate_projections # read CBO data @@ -209,8 +200,6 @@ def report(): skiprows=8, index_col=[0, 1], ) - rev_proj = rev_proj.dropna(axis=0) - cbo_df = CBO_projections(rev_proj) # compare tax calculator projections @@ -349,78 +338,6 @@ def report(): template_args["puf_tot_cdt_table"] = None template_args["puf_inctax_af_credit_table"] = None - # # distribution plots - # dist_vars = [ - # ("c00100", "AGI Distribution"), - # ("combined", "Tax Liability Distribution"), - # ] - # dist_plots = [] - # for var, title in dist_vars: - # plot = distplot(calcs, calc_labels, var, title=title) - # img_path = Path(CUR_PATH, f"{var}_dist.png") - # plot.save(str(img_path)) - # plot_paths.append(img_path) - # dist_plots.append(f"![]({str(img_path)})" + "{.center}") - # template_args["cps_dist_plots"] = dist_plots - - # # aggregate totals - # aggs = defaultdict(list) - # var_list = ["payrolltax", "iitax", "combined", "standard", "c04470"] - # for year in range(first_year, tc.Policy.LAST_BUDGET_YEAR + 1): - # base_aggs = run_calc(base_cps, year, var_list) - # new_aggs = run_calc(new_cps, year, var_list) - # aggs["Tax Liability"].append(base_aggs["payrolltax"]) - # aggs["Tax"].append("Current Payroll") - # aggs["Year"].append(year) - # aggs["Tax Liability"].append(new_aggs["payrolltax"]) - # aggs["Tax"].append("New Payroll") - # aggs["Year"].append(year) - # aggs["Tax Liability"].append(base_aggs["iitax"]) - # aggs["Tax"].append("Current Income") - # aggs["Year"].append(year) - # aggs["Tax Liability"].append(new_aggs["iitax"]) - # aggs["Tax"].append("New Income") - # aggs["Year"].append(year) - # aggs["Tax Liability"].append(base_aggs["combined"]) - # aggs["Tax"].append("Current Combined") - # aggs["Year"].append(year) - # aggs["Tax Liability"].append(new_aggs["combined"]) - # aggs["Tax"].append("New Combined") - # aggs["Year"].append(year) - # agg_df = pd.DataFrame(aggs) - - # title = "Aggregate Tax Liability by Year" - # agg_chart = ( - # alt.Chart(agg_df, title=title) - # .mark_line() - # .encode( - # x=alt.X( - # "Year:O", - # axis=alt.Axis(labelAngle=0, titleFontSize=20, labelFontSize=15), - # ), - # y=alt.Y( - # "Tax Liability", - # title="Tax Liability (Billions)", - # axis=alt.Axis(titleFontSize=20, labelFontSize=15), - # ), - # color=alt.Color( - # "Tax", - # legend=alt.Legend(symbolSize=150, labelFontSize=15, titleFontSize=20), - # ), - # ) - # .properties(width=800, height=350) - # .configure_title(fontSize=24) - # ) - # img_path = Path(CUR_PATH, "agg_plot.png") - # agg_chart.save(str(img_path)) - # plot_paths.append(img_path) - # template_args["agg_plot"] = f"![]({str(img_path)})" + "{.center}" - - # # create tax liability tables - # template_args["combined_table"] = agg_liability_table(agg_df, "Combined") - # template_args["payroll_table"] = agg_liability_table(agg_df, "Payroll") - # template_args["income_table"] = agg_liability_table(agg_df, "Income") - # write report and delete images used output_path = Path(CUR_PATH, "reports", f"taxdata_report_{date}.pdf") write_page(output_path, TEMPLATE_PATH, **template_args) diff --git a/history/report_utils.py b/history/report_utils.py index d8f803a5..3023cb54 100644 --- a/history/report_utils.py +++ b/history/report_utils.py @@ -1,15 +1,15 @@ """ Utility functions used by report.py """ + import pypandoc import pandas as pd import numpy as np -import altair as alt import taxcalc as tc from jinja2 import Template from pathlib import Path from collections import defaultdict - +import plotly.express as px CUR_PATH = Path(__file__).resolve().parent EPSILON = 1e-9 @@ -347,35 +347,15 @@ def getdata(calc, var, income_measure): else: y_label = "Total (billions)" y_format = "$.3f" - plt = ( - alt.Chart(melted, title=title) - .mark_circle(size=50) - .encode( - alt.X( - "index:O", - sort=index, - axis=alt.Axis( - title="Expanded Income Bin", - labelAngle=-90, - labelFontSize=15, - titleFontSize=20, - ), - ), - alt.Y( - "value", - axis=alt.Axis( - format=y_format, title=y_label, labelFontSize=15, titleFontSize=20 - ), - ), - color=alt.Color( - "variable", - legend=alt.Legend( - title="File", symbolSize=150, labelFontSize=15, titleFontSize=20 - ), - ), - ) - .properties(width=width, height=height) - .configure_title(fontSize=24) + plt = px.scatter( + melted, + x="index", + y="value", + labels={"index": "Expanded Income Bin", "value": y_label}, + color="variable", + title=title, + width=800, + height=425, ) return plt @@ -404,7 +384,7 @@ def write_page(pathout, template_path, **kwargs): ) -def cbo_bar_chart(cbo_data, var, title, bar_width=30, width=600, height=250): +def cbo_bar_chart(cbo_data, var, title): """ Creates a bar chart comparing the current and new CBO projections Parameters @@ -413,31 +393,19 @@ def cbo_bar_chart(cbo_data, var, title, bar_width=30, width=600, height=250): concatenated together var: Y-axis variable title: title of the chart - bar_width: width of the bars in the plot - width: width of the chart - height: height of the chart """ - # we divide up total width equally among facets of the chart - _width = width / len(cbo_data["index"].value_counts()) - chart = ( - alt.Chart(cbo_data, title=title) - .mark_bar(width=bar_width) - .encode( - x=alt.X( - "Projections", - axis=alt.Axis(title=None, labels=False, ticks=False, labelFontSize=15), - ), - y=alt.Y(var, axis=alt.Axis(labelFontSize=10, titleFontSize=15)), - color=alt.Color("Projections"), - column=alt.Column( - "index", header=alt.Header(title=None, labelOrient="bottom") - ), - ) - .properties(height=height, width=_width) - .configure_view(stroke="transparent") - .configure_facet(spacing=0) - .configure_title(fontSize=20) + + chart = px.bar( + cbo_data, + x="index", + y=var, + color="Projections", + barmode="group", + labels={"index": "Year", var: title}, + width=800, + height=350, ) + return chart @@ -482,47 +450,24 @@ def form_output(meta, var_list): return added_vars, removed_vars -def growth_scatter_plot(data, rows, point_size=150, width=600, height=300, columns=2): +def growth_scatter_plot(data, var): """ Create a scatter plot to show changes in growth factors Parameters ---------- data: growth factor data - factor: factor we"re plotting """ - max_val = data.max().drop(index=["YEAR", "Growth Factors"]).max() - min_val = data.min().drop(index=["YEAR", "Growth Factors"]).min() - chart = ( - alt.Chart(data) - .mark_circle(size=point_size, filled=True) - .encode( - x=alt.X( - "YEAR", - type="ordinal", - axis=alt.Axis(labelAngle=-45, labelFontSize=25, titleFontSize=30), - ), - y=alt.Y( - alt.repeat(), - type="quantitative", - scale=alt.Scale(domain=[min_val, max_val]), - axis=alt.Axis(labelFontSize=25, titleFontSize=30), - ), - color=alt.Color( - "Growth Factors", - legend=alt.Legend( - symbolSize=300, - labelFontSize=20, - titleFontSize=25, - direction="horizontal", - orient="top", - ), - ), - ) - .properties(width=width, height=height) - .repeat(rows, columns=columns) - .configure_legend(labelLimit=0, titleLimit=0) + plot = px.scatter( + data, + x="YEAR", + y=var, + range_x=[2024, 2035], + range_y=[0.85, 1.15], + color="Growth Factors", + width=800, + height=350, ) - return chart + return plot def agg_liability_table(data, tax): @@ -656,81 +601,91 @@ def CBO_projections(rev_proj): Read CBO published projections values from the webpage "https://www.cbo.gov/about/products/budget-economic-data" """ - # extract values for AGI rows in the excel file - salary_wage = rev_proj.loc["Calculation of Adjusted Gross Income (AGI)"].loc[ + salary_wage = rev_proj.loc["Calculation of adjusted gross income (AGI)"].loc[ "Salaries and wages" ] + + for indx in salary_wage.index: + if type(indx) != int: + salary_wage = salary_wage.drop(indx) + taxable_interest_ordinary_divid = rev_proj.loc[ - "Calculation of Adjusted Gross Income (AGI)" + "Calculation of adjusted gross income (AGI)" ].loc["Taxable interest and ordinary dividends (excludes qualified dividends)"] - q_div = rev_proj.loc["Calculation of Adjusted Gross Income (AGI)"].loc[ + q_div = rev_proj.loc["Calculation of adjusted gross income (AGI)"].loc[ "Qualified dividends " ] - capital_g_l = rev_proj.loc["Calculation of Adjusted Gross Income (AGI)"].loc[ + capital_g_l = rev_proj.loc["Calculation of adjusted gross income (AGI)"].loc[ "Capital gain or lossa" ] - business_inc = rev_proj.loc["Calculation of Adjusted Gross Income (AGI)"].loc[ + business_inc = rev_proj.loc["Calculation of adjusted gross income (AGI)"].loc[ "Net business income (all income and loss reported on Schedules C, E, and F)b" ] pension_annuities_IRAdis = rev_proj.loc[ - "Calculation of Adjusted Gross Income (AGI)" + "Calculation of adjusted gross income (AGI)" ].loc["Taxable pensions and annuities and IRA distributions"] - ssb = rev_proj.loc["Calculation of Adjusted Gross Income (AGI)"].loc[ + ssb = rev_proj.loc["Calculation of adjusted gross income (AGI)"].loc[ "Taxable Social Security benefits " ] - other_inc = rev_proj.loc["Calculation of Adjusted Gross Income (AGI)"].loc[ + other_inc = rev_proj.loc["Calculation of adjusted gross income (AGI)"].loc[ "All other sources of incomec" ] - total_inc = rev_proj.loc["Calculation of Adjusted Gross Income (AGI)"].loc[ + total_inc = rev_proj.loc["Calculation of adjusted gross income (AGI)"].loc[ "Total income" ] - stat_adj = rev_proj.loc["Calculation of Adjusted Gross Income (AGI)"].loc[ - "Subtract Statutory adjustments " - ] - total_agi = rev_proj.loc["Calculation of Adjusted Gross Income (AGI)"].loc[ - "Adjusted gross income " + stat_adj = rev_proj.loc["Calculation of adjusted gross income (AGI)"].loc[ + "Subtract statutory adjustments " ] - sub_peronal_expt = rev_proj.loc["Calculation of Taxable Income"].loc[ - "Subtract Personal exemption amount (after limit)" + total_agi = ( + rev_proj.loc["Calculation of adjusted gross income (AGI)"] + .loc["Adjusted gross income "] + .iloc[0] + ) + sub_peronal_expt = rev_proj.loc["Calculation of taxable income"].loc[ + "Subtract personal exemption amount (after limit)" ] - sub_std = rev_proj.loc["Calculation of Taxable Income"].loc[ - "Subtract Standard deduction (non-itemizers only)" + sub_std = rev_proj.loc["Calculation of taxable income"].loc[ + "Subtract standard deduction (non-itemizers only)" ] - sub_tot_item = rev_proj.loc["Calculation of Taxable Income"].loc[ - "Subtract Total itemized deductions (itemizers only) after limitsd" + sub_tot_item = rev_proj.loc["Calculation of taxable income"].loc[ + "Subtract total itemized deductions (itemizers only) after limitsd" ] - sub_qbid = rev_proj.loc["Calculation of Taxable Income"].loc[ - "Subtract Qualified business income deduction" + sub_qbid = rev_proj.loc["Calculation of taxable income"].loc[ + "Subtract qualified business income deduction" ] - sub_tot_expt = rev_proj.loc["Calculation of Taxable Income"].loc[ + sub_tot_expt = rev_proj.loc["Calculation of taxable income"].loc[ "Total exemptions and deductions after limitse" ] - taxable_inc = rev_proj.loc["Calculation of Taxable Income"].loc["Taxable incomef"] - tot_inctax = rev_proj.loc["Calculation of Income Tax Liability"].loc[ + taxable_inc = ( + rev_proj.loc["Calculation of taxable income"].loc["Taxable incomef"].iloc[0] + ) + tot_inctax = rev_proj.loc["Calculation of income tax liability"].loc[ "Total income tax (including AMT) before credits" ] - tot_cdt = rev_proj.loc["Calculation of Income Tax Liability"].loc[ + tot_cdt = rev_proj.loc["Calculation of income tax liability"].loc[ "Total credits (refundable and nonrefundable)i" ] - inctax_af_credit = rev_proj.loc["Calculation of Income Tax Liability"].loc[ + inctax_af_credit = rev_proj.loc["Calculation of income tax liability"].loc[ "Income tax after creditsj" ] - Top1p = rev_proj.loc["Shares of AGI by Income Group (Percent)o"].loc[ + Top1p = rev_proj.loc["Shares of AGI by income group (percent)o"].loc[ "Top 1 percent" ] - Top5p = rev_proj.loc["Shares of AGI by Income Group (Percent)o"].loc[ + Top5p = rev_proj.loc["Shares of AGI by income group (percent)o"].loc[ "Top 5 percent" ] - Top10p = rev_proj.loc["Shares of AGI by Income Group (Percent)o"].loc[ + Top10p = rev_proj.loc["Shares of AGI by income group (percent)o"].loc[ "Top 10 percent" ] - Top25p = rev_proj.loc["Shares of AGI by Income Group (Percent)o"].loc[ + Top25p = rev_proj.loc["Shares of AGI by income group (percent)o"].loc[ "Top 25 percent" ] - Top50p = rev_proj.loc["Shares of AGI by Income Group (Percent)o"].loc[ - "Top 50 percent" - ] + Top50p = ( + rev_proj.loc["Shares of AGI by income group (percent)o"] + .loc["Top 50 percent"] + .iloc[0] + ) var_list = [ salary_wage, @@ -786,6 +741,10 @@ def CBO_projections(rev_proj): "Top25p", "Top50p", ] + + for var in var_list: + var = var.dropna() + df = pd.DataFrame(var_list, index=var_names).round(1) df.columns = df.columns.astype(str) df_cols = set(df.columns) @@ -804,9 +763,7 @@ def validation_table(df_tax_data, df_cbo, category): new_df = new_df.set_index("Year").round(1) new_df = new_df.rename_axis(index=None).squeeze() new_df.index = new_df.index.astype(str) - df_cbo = df_cbo.drop( - columns=["2019", "2020", "2021", "2022"], axis=1, inplace=False - ) + df_cbo = df_cbo.drop(columns=["2019", "2022"], axis=1, inplace=False) df_cbo = df_cbo.transpose() df_cbo_sal = df_cbo.loc[:, df_cbo.columns.str.contains(category)].squeeze() df_cbo_sal = df_cbo_sal.astype(float) @@ -821,7 +778,6 @@ def validation_table(df_tax_data, df_cbo, category): percent_difference=pct_change, ) ) - return final_df.to_markdown() @@ -852,7 +808,7 @@ def compare_calcs(base, new, name, template_args, plot_paths): for var, title in dist_vars: plot = distplot(calcs, calc_labels, var, title=title) img_path = Path(CUR_PATH, f"{name}_{var}_dist.png") - plot.save(str(img_path)) + plot.write_image(str(img_path)) plot_paths.append(img_path) dist_plots.append(f"![]({str(img_path)})" + "{.center}") template_args[f"{name}_dist_plots"] = dist_plots @@ -1110,29 +1066,20 @@ def compare_calcs(base, new, name, template_args, plot_paths): agg3_df = pd.DataFrame(aggs3) title = "Aggregate Tax Liability by Year" - agg_chart = ( - alt.Chart(agg_df, title=title) - .mark_line() - .encode( - x=alt.X( - "Year:O", - axis=alt.Axis(labelAngle=0, titleFontSize=20, labelFontSize=15), - ), - y=alt.Y( - "Tax Liability", - title="Tax Liability (Billions)", - axis=alt.Axis(titleFontSize=20, labelFontSize=15), - ), - color=alt.Color( - "Tax", - legend=alt.Legend(symbolSize=150, labelFontSize=15, titleFontSize=20), - ), - ) - .properties(width=800, height=350) - .configure_title(fontSize=24) + agg_chart = px.line( + agg_df, + x="Year", + y="Tax Liability", + range_x=[2024, 2035], + range_y=[0, 6500], + color="Tax", + line_shape="spline", + width=800, + height=425, + title=title, ) img_path = Path(CUR_PATH, f"{name}_agg_plot.png") - agg_chart.save(str(img_path)) + agg_chart.write_image(str(img_path)) plot_paths.append(img_path) template_args[f"{name}_agg_plot"] = f"![]({str(img_path)})" + "{.center}" @@ -1410,5 +1357,4 @@ def CBO_validation(cbo_df, new, name, template_args): share_keyword_list = ["Top1p", "Top5p", "Top10p", "Top25p", "Top50p"] for table_name, keyword in zip(shareval_table_name_list, share_keyword_list): template_args[table_name] = validation_table(agg3_df, cbo_df, keyword) - return template_args diff --git a/history/reports/taxdata_report_2024-03-06.pdf b/history/reports/taxdata_report_2024-03-06.pdf new file mode 100644 index 00000000..662ed494 Binary files /dev/null and b/history/reports/taxdata_report_2024-03-06.pdf differ diff --git a/inithash.py b/inithash.py index 27ac7b8d..bbb7b08b 100644 --- a/inithash.py +++ b/inithash.py @@ -1,6 +1,7 @@ """ This script creates the initial hashes for each stage 2 file """ + import json import hashlib from pathlib import Path diff --git a/puf_stage1/CBO_baseline.csv b/puf_stage1/CBO_baseline.csv index 94b4aacd..87903619 100644 --- a/puf_stage1/CBO_baseline.csv +++ b/puf_stage1/CBO_baseline.csv @@ -1,16 +1,16 @@ -,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023,2024,2025,2026,2027,2028,2029,2030,2031,2032,2033 -GDP,14718.6,14418.7,14964.4,15517.9,16163.2,16800,17348.1,18036.7,18624.5,19479.6,20527.2,21372.6,21060.5,23315.1,25419.5,26438.4,27591.9,28947,30262.4,31573.1,32843.4,34138.2,35468.3,36831.8,38224.9,39645.9 -TPY,12429.6,12087.5,12429.3,13202,13887.7,14166.9,14694.2,15458.5,15928.7,16850.2,17706,18424.4,19832.3,21294.8,21766.7,23120.9,24197.9,25223.9,26400.2,27559.6,28745.6,29949.9,31206.2,32491.9,33855.8,35242.2 -Wages,6531.9,6251.4,6377.5,6633.2,6932.1,7124.7,7477.8,7854.8,8085.3,8474.7,8900.5,9323.5,9457.4,10290.1,11160.2,11719,12275.6,12874.2,13431.8,13945.9,14481.3,15039,15610.8,16196.8,16790.9,17394.6 -SCHC,979.5,937.5,986.7,1068.1,1187.9,1253.5,1268.5,1336.8,1298.7,1466.4,1541.5,1560.5,1598,1702.3,1754,1818.5,1905.9,2003.6,2108.8,2211.1,2314.3,2419.4,2525.5,2632.6,2741.7,2851.7 -SCHF,47,35.5,46,75.5,72.3,83.2,78.1,40,43.2,39.5,38.9,38.4,45.2,51.3,90.1,93.8,82.3,72.9,66.7,62.8,60.5,59.1,58.4,58.1,58.1,58.3 -INTS,1361.6,1264.3,1195,1231.6,1255.9,1255.2,1302,1302.8,1415.3,1553.4,1615,1652,1647.3,1658.6,1753.4,2074.3,2259.3,2344.8,2512,2682,2818.5,2936.4,3058,3175.5,3298.6,3432.7 -DIVS,805.4,553.7,544.6,682.2,832.7,824.5,815.5,951.1,962.5,1154.5,1253.3,1316,1448.1,1543.9,1621.6,1660.1,1654.4,1685.9,1746.3,1821.7,1900.3,1975.9,2053,2131.9,2212.5,2294.8 -RENTS,262.1,333.7,402.8,485.3,533,595.8,610.8,659.6,707.4,652.7,681.9,692.1,719.9,723.8,783.4,840.8,865.4,873,892,929.9,969.1,1012.5,1059.2,1110.7,1165.3,1216.6 -CGNS,498,263,394,404,647,511,716,725,641,871.3,944,881,1147.7,2033.6,1694.2,1480.2,1364.7,1308.8,1280.8,1277.1,1288.6,1312.4,1345.5,1385,1429.2,1476.8 -BOOK,1285.1,1397,1746.4,1816.6,2022.8,2106.9,2072.9,2088.1,2073.5,2128.9,2305,2367.8,2260.1,2771.1,2925.1,2573.6,2594.4,2866.3,3060.7,3237.6,3364.5,3476.4,3597.2,3723.9,3860.9,3997.7 -RETS,142.5,140.5,142.9,145.4,144.9,146.6,148.3,147.8,149.7,149.9,152.5,153.5,160.1,164.4,170.7,167.3,168.6,169.9,171.2,172.6,174,175.5,177,178.6,180.1,181.6 -SOCSEC,503,544.5,572.5,591.5,627.2,663.2,698.2,733.7,762.1,791.1,833,888.1,940.2,982.7,1063.4,1148.7,1226.1,1302.8,1383.6,1467.4,1557.4,1650.6,1746.5,1844.8,, -CPIU,215.3,214.5,218.1,224.9,229.6,233,236.7,237,240,245.1,251.1,255.6,258.8,271,292.9,306.9,316.2,323.1,329.7,336.5,343.8,351.6,359.6,367.8,376.1,384.7 -CPIM,364.1,375.6,388.4,400.3,414.9,425.1,435.3,446.8,463.7,475.3,484.7,498.4,518.9,525.3,546.6,551.6,527.7,534.6,541.2,548,555.3,563.1,571.1,579.3,587.6,596.2 -UCOMP,51.1,131.2,138.9,107.2,83.6,62.2,43.8,39.9,31.2,31.1,28.7,27,27.925,240.656,36.743,27.511,31.4,33.922,36.907,40.003,43.608,46.439,48.195,49.829,51.225, \ No newline at end of file +,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023,2024,2025,2026,2027,2028,2029,2030,2031,2032,2033,2034 +GDP,14718.6,14418.7,14964.4,15517.9,16163.2,16800.0,17348.1,18036.7,18624.5,19479.6,20527.2,21372.6,21060.5,23315.1,25419.5,27340.9,28418.0,29564.9,30812.7,32074.8,33371.4,34714.2,36094.5,37515.9,38979.4,40487.6,42036.7 +TPY,12429.6,12087.5,12429.3,13202.0,13887.7,14166.9,14694.2,15458.5,15928.7,16850.2,17706.0,18424.4,19832.3,21294.8,21766.7,23030.5,24275.3,25439.7,26630.3,27812.2,29035.1,30278.7,31587.2,32943.3,34353.8,35797.6,37278.7 +Wages,6531.9,6251.4,6377.5,6633.2,6932.1,7124.7,7477.8,7854.8,8085.3,8474.7,8900.5,9323.5,9457.4,10290.1,11160.2,11807.6,12375.8,12951.6,13513.9,14066.1,14630.7,15220.3,15828.2,16451.1,17085.4,17728.3,18382.3 +SCHC,979.5,937.5,986.7,1068.1,1187.9,1253.5,1268.5,1336.8,1298.7,1466.4,1541.5,1560.5,1598.0,1702.3,1754.0,1790.6,1875.5,1960.3,2049.0,2133.8,2216.4,2300.1,2386.0,2476.1,2572.0,2675.3,2780.3 +SCHF,47.0,35.5,46.0,75.5,72.3,83.2,78.1,40.0,43.2,39.5,38.9,38.4,45.2,51.3,90.1,59.3,53.5,51.9,51.6,51.9,52.6,53.5,54.4,55.3,56.2,57.0,57.8 +INTS,1361.6,1264.3,1195.0,1231.6,1255.9,1255.2,1302.0,1302.8,1415.3,1553.4,1615.0,1652.0,1647.3,1658.6,1753.4,1813.1,2111.7,2322.0,2568.3,2758.7,2918.7,3026.6,3159.1,3303.7,3457.7,3588.5,3707.1 +DIVS,805.4,553.7,544.6,682.2,832.7,824.5,815.5,951.1,962.5,1154.5,1253.3,1316.0,1448.1,1543.9,1621.6,1841.0,1897.5,1959.8,2012.9,2054.0,2112.7,2195.1,2282.2,2372.0,2464.5,2559.8,2657.6 +RENTS,262.1,333.7,402.8,485.3,533.0,595.8,610.8,659.6,707.4,652.7,681.9,692.1,719.9,723.8,783.4,961.1,959.8,947.4,940.9,965.1,1010.0,1061.5,1114.7,1164.8,1210.8,1257.7,1305.8 +CGNS,498.0,263.0,394.0,404.0,647.0,511.0,716.0,725.0,641.0,871.3,944.0,881.0,1147.7,2072.7,1319.1,1398.9,1313.9,1293.6,1264.1,1265.0,1285.4,1318.5,1359.7,1406.4,1457.2,1511.1,1567.4 +BOOK,1285.1,1397.0,1746.4,1816.6,2022.8,2106.9,2072.9,2088.1,2073.5,2128.9,2305.0,2367.8,2260.1,2771.1,2925.1,3215.7,3263.0,3353.8,3427.5,3512.3,3621.3,3748.0,3863.6,3984.2,4121.1,4262.4,4414.5 +RETS,142.5,140.5,142.9,145.4,144.9,146.6,148.3,147.8,149.7,149.9,152.5,153.5,160.1,164.4,163.2,165.2,167.1,168.7,170.3,171.9,173.6,175.3,177.0,178.6,180.4,182.1,183.8 +SOCSEC,503.0,544.5,572.5,591.5,627.2,663.2,698.2,733.7,762.1,791.1,833.0,888.1,940.2,982.7,1063.4,1190.9,1291.4,1372.6,1454.4,1538.5,1627.6,1719.7,1813.9,1909.2,2005.2,2106.0,2211.9 +CPIU,215.3,214.5,218.1,224.9,229.6,233.0,236.7,237.0,240.0,245.1,251.1,255.6,258.8,271.0,292.9,304.7,312.6,320.4,327.9,335.1,342.4,350.0,357.8,365.8,374.1,382.5,391.1 +CPIM,364.1,375.6,388.4,400.3,414.9,425.1,435.3,446.8,463.7,475.3,484.7,498.4,518.9,525.3,546.5,549.1,556.8,533.8,541.3,548.5,555.8,563.4,571.2,579.2,587.5,595.9,604.5 +UCOMP,51.1,131.2,138.9,107.2,83.6,62.2,43.8,39.9,31.2,31.1,28.7,27.0,27.925,240.656,36.743,27.511,36.8,42.5,44.0,46.0,48.0,50.2,52.4,54.4,56.1,57.7,59.4 diff --git a/puf_stage1/Stage_II_targets.csv b/puf_stage1/Stage_II_targets.csv index 0ef58f2e..24fe7be2 100644 --- a/puf_stage1/Stage_II_targets.csv +++ b/puf_stage1/Stage_II_targets.csv @@ -1,31 +1,31 @@ -,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023,2024,2025,2026,2027,2028,2029,2030,2031,2032,2033 -US Population,311721632,314112078,316497531,318857056,321368864,323995528,326625791,329256465,331883986,334503458,337108968,339698079,342267302,344814299,347334912,349825585,352281475,354698370,357072830,359402194,361684740,363919527,366106294 -POP_DEP,82840576,82503131,82296428,82135602,82109509,82178228,82284937,82410728,82547300,82624346,82772040,83023463,83259014,83463249,83673850,83868421,84024180,84193698,84484144,84767392,85040759,85334627,85631465 -POP_SNR,41366628,43164909,44723041,46243211,47830245,49420383,51055052,52766466,54556914,56441027,58292098,60221375,62126945,63987872,65919552,67748101,69455598,71098995,72675827,74107408,75245391,76250731,77185290 -Single Returns,67294506,66655855,68563354,69579590,71086947,71410690,73021932,74164397,75166909,76052548,76951274,77812834,78684040,79565000,80455824,81356621,82267505,83188586,84119980,85061802,86014169,86977199,87951011 -Joint Returns,56013790,56458434,56796607,55128595,57272012,57201828,57987204,58894443,59690545,60393837,61107520,61791691,62483522,63183098,63890507,64605837,65329175,66060612,66800238,67548145,68304426,69069175,69842485 -Head of Household Returns,22061944,21814184,21991339,22077498,22134303,21659639,21894095,22236639,22537222,22802762,23072226,23330546,23591759,23855897,24122992,24393077,24666186,24942353,25221612,25503998,25789545,26078289,26370266 -Number of Returns w/ Gross Security Income,25837226,26480552,27070833,27401498,28087514,28329015,28967603,29938625,30954489,32023496,33073756,34168389,35249571,36305423,37401419,38438901,39407700,40340131,41234793,42047043,42692712,43263121,43793371 -Number of Dependent Exemptions,99345455,97912393,97691386,96916673,96505181,94809260,94708629,94853412,95010605,95099283,95269277,95558660,95829776,96064847,96307245,96531193,96710470,96905582,97239881,97565894,97880535,98218773,98560428 -Taxable Interest Income,120111673,111789613,100648711,93894280,95881223,96640233,106055367,110260987,112787090,112466207,113237693,119709978,141618802,154249318,160086664,171501920,183108339,192427612,200477005,208779009,216801093,225205506,234360923 -Ordinary Dividends,194609806,260393306,214972683,254702232,260252720,254065327,282336042,306497844,321831296,354136702,377564846,396566588,405981865,404587915,412291324,427062304,445501574,464723413,483211594,502066604,521361809,541072753,561199436 -Business Income (Schedule C),337210620,356450905,357363490,374659000,391975736,389078638,416010104,437315586,442705788,453344344,482933715,497600738,515899055,540693983,568410969,598255665,627277647,656554953,686371280,716471302,746855019,777806125,809012557 -Business Loss (Schedule C),54240803,52259366,55290946,57400238,60161435,60996610,69637956,73204384,74106676,75887516,80840625,83295809,86358854,90509397,95149078,100144927,105003058,109903929,114895029,119933618,125019697,130200753,135424549 -Net Capital Gains in AGI,402566646,644856734,504322768,705007630,713598090,634341278,859894631,931642984,869467657,1132676539,2006980055,1672022821,1460824094,1346835996,1291667730,1264034252,1260382685,1271732149,1295220606,1327887325,1366870267,1410491687,1457468600 -Taxable Pensions and Annuities,581180358,612544219,638659076,663223262,689991999,693626543,729187412,766221903,797310451,858236906,921526160,941947493,1000550096,1047156952,1091556798,1142460832,1192633524,1243957322,1296073048,1350439058,1406077345,1465099713,1525095762 -Supplemental Income (Schedule E),661331485,777023944,780713118,846331543,891134646,882933054,973306129,1053816820,1082528185,1033289108,1266911839,1337318689,1176617339,1186126836,1310436074,1399313293,1480189733,1538206807,1589366070,1644594301,1702519937,1765154603,1827697831 -Supplemental Loss (Schedule E),175315530,163765597,167171652,166947674,177896945,176446339,206369393,223440016,229527666,219087541,268622399,283550712,249477322,251493613,277850811,296695383,313843556,326144874,336992136,348702137,360984068,374264451,387525446 -Gross Social Security Income,490699539,526514454,553542772,575126918,605152093,619856114,644989570,679150944,724074374,766551882,801202440,866997736,936543445,999648226,1062182293,1128059119,1196381867,1269759520,1345746156,1423934122,1504078825,1504078825,1504078825 -Unemployment Compensation,92383693,71234134,51923279,33288898,27225383,25420264,23946035,22098109,20789162,21501384,185297653,28290970,21182616,24177026,26118887,28417245,30801069,33576807,35756589,37108655,38366784,39441661,39441661 -Wages and Salaries: Zero or Less,21437416,20445434,20280688,19421543,20111022,20544631,20869123,21917664,22959310,23289042,25339583,27482222,28858278,30228917,31702982,33076084,34342065,35660499,37033847,38441916,39884953,41347936,42834560 -"Wages and Salaries: $1 Less Than $10,000",92961755,93108807,94466204,94899140,91906875,90725454,86507256,90853698,95171558,96538370,105038328,113920054,119624120,125305730,131416064,137107881,142355663,147820870,153513708,159350475,165332192,171396590,177558983 -"Wages and Salaries: $10,000 Less Than $20,000",265080549,262184682,266041138,261995646,261659142,253415638,247511878,259947782,272301910,276212590,300532405,325944524,342264823,358520869,376003566,392288818,407303609,422940489,439228661,455928638,473043339,490394609,508026256 -"Wages and Salaries: $20,000 Less Than $30,000",373549061,371577702,380567075,381259619,383184602,382875414,382789227,402021961,421128224,427176282,464788066,504089151,529329292,554470062,581507908,606693846,629914956,654098155,679288610,705115941,731584664,758419252,785687457 -"Wages and Salaries: $30,000 Less Than $40,000",410623212,408353008,408654349,418567676,428313928,436140082,441282302,463453943,485479786,492452033,535811181,581117768,610214792,639197261,670366693,699401232,726170703,754049276,783089023,812862964,843376307,874311422,905746413 -"Wages and Salaries: $40,000 Less Than $50,000",391671646,391349650,410049846,418379915,424369612,426147995,437485582,459466462,481302798,488215057,531201150,576117927,604964605,633697713,664598969,693383700,719922850,747561561,776351454,805869225,836120037,866788991,897953521 -"Wages and Salaries: $50,000 Less Than $75,000",900170384,902783183,915963625,916618937,952347137,962308451,1000500360,1050769166,1100707412,1116515287,1214821617,1317543290,1383513720,1449224423,1519893534,1585722295,1646415563,1709623451,1775464018,1842969193,1912150782,1982288635,2053559838 -"Wages and Salaries: $75,000 Less Than $100,000",791646425,798324358,822009437,840581301,835434509,852517230,870406373,914138780,957583610,971336004,1056859667,1146224551,1203616917,1260783328,1322263411,1379532529,1432333916,1487322951,1544602339,1603329889,1663515870,1724533773,1786537659 -"Wages and Salaries: $100,000 Less Than $200,000",1521442934,1599743841,1665691829,1759304940,1876094165,1922367424,2015029480,2116271949,2216848662,2248686066,2446677151,2653560834,2786426714,2918769500,3061098627,3193679183,3315916743,3443218805,3575823138,3711780028,3851113253,3992372414,4135914167 -"Wages and Salaries: $200,000 Less Than $500,000",750627685,806518068,872227137,955295796,1055689937,1106449651,1206754121,1267385873,1327618918,1346685596,1465257836,1589155645,1668725919,1747982924,1833220516,1912619916,1985825138,2062063371,2141477011,2222898419,2306341835,2390938649,2476902455 -"Wages and Salaries: $500,000 Less Than $1 Million",230634407,259165177,272996984,310372311,337666673,343994542,379375686,398436911,417372793,423366917,460643297,499593913,524608973,549525549,576322284,601283625,624297660,648265204,673231022,698828036,725060723,751656012,778681052 -Wages and Salaries: $1 Million and Over,305543960,387803684,346432571,408251028,336316005,310089733,367731740,386207931,404562625,410372775,446505054,484260182,508507471,532659297,558633576,582828795,605136474,628368396,652567954,677379335,702806878,728585894,754781470 +,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023,2024,2025,2026,2027,2028,2029,2030,2031,2032,2033,2034 +US Population,311721632,314112078,316497531,318857056,321368864,323995528,326625791,329256465,331883986,334503458,337108968,339698079,342267302,344814299,347334912,349825585,352281475,354698370,357072830,359402194,361684740,363919527,366106294,368245560 +POP_DEP,82840576,82503131,82296428,82135602,82109509,82178228,82284937,82410728,82547300,82624346,82772040,83023463,83259014,83463249,83673850,83868421,84024180,84193698,84484144,84767392,85040759,85334627,85631465,85903535 +POP_SNR,41366628,43164909,44723041,46243211,47830245,49420383,51055052,52766466,54556914,56441027,58292098,60221375,62126945,63987872,65919552,67748101,69455598,71098995,72675827,74107408,75245391,76250731,77185290,78138264 +Single Returns,67294506,66655855,68563354,69579590,71086947,71410690,73021932,74164397,75166909,76052548,76951274,77812834,78684040,79565000,80455824,81356621,82267505,83188586,84119980,85061802,86014169,86977199,87951011,88935726 +Joint Returns,56013790,56458434,56796607,55128595,57272012,57201828,57987204,58894443,59690545,60393837,61107520,61791691,62483522,63183098,63890507,64605837,65329175,66060612,66800238,67548145,68304426,69069175,69842485,70624454 +Head of Household Returns,22061944,21814184,21991339,22077498,22134303,21659639,21894095,22236639,22537222,22802762,23072226,23330546,23591759,23855897,24122992,24393077,24666186,24942353,25221612,25503998,25789545,26078289,26370266,26665512 +Number of Returns w/ Gross Security Income,25837226,26480552,27070833,27401498,28087514,28329015,28967603,29938625,30954489,32023496,33073756,34168389,35249571,36305423,37401419,38438901,39407700,40340131,41234793,42047043,42692712,43263121,43793371,44334069 +Number of Dependent Exemptions,99345455,97912393,97691386,96916673,96505181,94809260,94708629,94853412,95010605,95099283,95269277,95558660,95829776,96064847,96307245,96531193,96710470,96905582,97239881,97565894,97880535,98218773,98560428,98873577 +Taxable Interest Income,120111673,111789613,100648711,93894280,95881223,96640233,106055367,110260987,112787090,112466207,113237693,119709978,123785880,144172215,158530039,175345693,188344883,199268572,206635235,215681415,225553699,236067750,244997866,253095050 +Ordinary Dividends,194609806,260393306,214972683,254702232,260252720,254065327,282336042,306497844,321831296,354136702,377564846,396566588,450221441,464038666,479274296,492260042,502311157,516666398,536817536,558118073,580078901,602700022,626005890,649923140 +Business Income (Schedule C),337210620,356450905,357363490,374659000,391975736,389078638,416010104,437315586,442705788,453344344,482933715,497600738,507983969,532069660,556126982,581290714,605348036,628781229,652526487,676895873,702456777,729663112,758968788,788756746 +Business Loss (Schedule C),54240803,52259366,55290946,57400238,60161435,60996610,69637956,73204384,74106676,75887516,80840625,83295809,85033909,89065730,93092802,97305082,101332154,105254750,109229584,113308895,117587659,122141860,127047479,132033831 +Net Capital Gains in AGI,402566646,644856734,504322768,705007630,713598090,634341278,859894631,931642984,869467657,1132676539,2045568233,1301832902,1380588316,1296700971,1276666699,1247552856,1248441075,1268574037,1301240756,1341901446,1387990140,1438125165,1491319611,1546882640 +Taxable Pensions and Annuities,581180358,612544219,638659076,663223262,689991999,693626543,729187412,766221903,797310451,858236906,921526160,941947493,996638063,1050506414,1100895479,1152418341,1203564714,1256485349,1310301770,1366926720,1425611546,1486650515,1549130533,1613224696 +Supplemental Income (Schedule E),661331485,777023944,780713118,846331543,891134646,882933054,973306129,1053816820,1082528185,1033289108,1266911839,1337318689,1470177331,1491802292,1533314902,1567009609,1605779096,1655612516,1713538152,1766389008,1821525802,1884114749,1948715320,2018253514 +Supplemental Loss (Schedule E),175315530,163765597,167171652,166947674,177896945,176446339,206369393,223440016,229527666,219087541,268622399,283550712,311720634,316305759,325107647,332251912,340472178,351038322,363320252,374526181,386216795,399487484,413184697,427928830 +Gross Social Security Income,490699539,526514454,553542772,575126918,605152093,619856114,644989570,679150944,724074374,766551882,801202440,866997736,970949411,1052887790,1119090739,1185782873,1254350213,1326994089,1402083888,1478885831,1556584613,1634854109,1717037081,1803378119 +Unemployment Compensation,92383693,71234134,51923279,33288898,27225383,25420264,23946035,22098109,20789162,21501384,185297653,28290970,21182616,28334858,32723681,33878635,35418573,36958511,38652442,40346374,41886312,43195259,44427210,45736157 +Wages and Salaries: Zero or Less,21437416,20445434,20280688,19421543,20111022,20544631,20869123,21917664,22959310,23289042,25339583,27482222,29076458,30475662,31893581,33278257,34638060,36028400,37480302,38977268,40511172,42073149,43656303,45266792 +"Wages and Salaries: $1 Less Than $10,000",92961755,93108807,94466204,94899140,91906875,90725454,86507256,90853698,95171558,96538370,105038328,113920054,120528523,126328542,132206140,137945934,143582630,149345901,155364366,161569631,167928012,174402760,180965295,187641136 +"Wages and Salaries: $10,000 Less Than $20,000",265080549,262184682,266041138,261995646,261659142,253415638,247511878,259947782,272301910,276212590,300532405,325944524,344852473,361447308,378264108,394686628,410814168,427303861,444523704,462278017,480470419,498995769,517772290,536872998 +"Wages and Salaries: $20,000 Less Than $30,000",373549061,371577702,380567075,381259619,383184602,382875414,382789227,402021961,421128224,427176282,464788066,504089151,533331218,558995943,585003947,610402178,635344206,660846324,687477654,714935566,743071006,771721366,800760175,830300354 +"Wages and Salaries: $30,000 Less Than $40,000",410623212,408353008,408654349,418567676,428313928,436140082,441282302,463453943,485479786,492452033,535811181,581117768,614828243,644414730,674396954,703676225,732429583,761828616,792529414,824183102,856617848,889646199,923122356,957176497 +"Wages and Salaries: $40,000 Less Than $50,000",391671646,391349650,410049846,418379915,424369612,426147995,437485582,459466462,481302798,488215057,531201150,576117927,609538362,638870292,668594554,697621911,726127880,755273969,785710621,817091967,849247650,881991830,915179964,948941109 +"Wages and Salaries: $50,000 Less Than $75,000",900170384,902783183,915963625,916618937,952347137,962308451,1000500360,1050769166,1100707412,1116515287,1214821617,1317543290,1393973598,1461053767,1529031171,1595414801,1660606053,1727261215,1796867810,1868634854,1942172758,2017056515,2092955566,2170165052 +"Wages and Salaries: $75,000 Less Than $100,000",791646425,798324358,822009437,840581301,835434509,852517230,870406373,914138780,957583610,971336004,1056859667,1146224551,1212716709,1271074515,1330212890,1387964728,1444679232,1502667295,1563223019,1625658271,1689634121,1754780824,1820810802,1887980822 +"Wages and Salaries: $100,000 Less Than $200,000",1521442934,1599743841,1665691829,1759304940,1876094165,1922367424,2015029480,2116271949,2216848662,2248686066,2446677151,2653560834,2807493137,2942594055,3079502025,3213200100,3344496698,3478741644,3618930841,3763471228,3911578165,4062395681,4215258019,4370759603 +"Wages and Salaries: $200,000 Less Than $500,000",750627685,806518068,872227137,955295796,1055689937,1106449651,1206754121,1267385873,1327618918,1346685596,1465257836,1589155645,1681342108,1762250894,1844241882,1924310538,2002941006,2083337170,2167293208,2253855072,2342552860,2432873949,2524419635,2617545905 +"Wages and Salaries: $500,000 Less Than $1 Million",230634407,259165177,272996984,310372311,337666673,343994542,379375686,398436911,417372793,423366917,460643297,499593913,528575212,554011070,579787147,604958887,629678494,654953196,681347039,708560095,736444635,764839504,793619358,822896111 +Wages and Salaries: $1 Million and Over,305543960,387803684,346432571,408251028,336316005,310089733,367731740,386207931,404562625,410372775,446505054,484260182,512351976,537007147,561992095,586391254,610352157,634851118,660434871,686812693,713841390,741364753,769261284,797639464 diff --git a/puf_stage1/Stage_I_factors.csv b/puf_stage1/Stage_I_factors.csv index 1c2da1c3..fd03e69e 100644 --- a/puf_stage1/Stage_I_factors.csv +++ b/puf_stage1/Stage_I_factors.csv @@ -9,16 +9,17 @@ YEAR,APOPN,APOPDEP,APOPSNR,AGDPN,ATXPY,ASCHF,ABOOK,ACPIU,ACPIM,ARETS,AWAGE,ASCHC 2018,1.0563,0.9948,1.2756,1.3228,1.3412,0.5152,1.2689,1.1165,1.2108,1.0683,1.2932,1.2969,1.3496,1.5935,1.2745,0.9180,1.5749,2.3143,1.3840,0.2392,0.8601,1.3326 2019,1.0647,0.9965,1.3189,1.3773,1.3956,0.5086,1.3034,1.1365,1.2451,1.0827,1.3547,1.3128,1.3663,1.6369,1.3092,0.9390,1.6537,2.1598,1.4756,0.2250,0.8950,1.4158 2020,1.0731,0.9974,1.3644,1.3572,1.5022,0.5987,1.2441,1.1507,1.2963,1.0955,1.3741,1.3444,1.3991,1.5624,1.2497,0.9363,1.8197,2.8136,1.5622,0.2327,0.9633,1.4223 -2021,1.0814,0.9992,1.4092,1.5025,1.6130,0.6795,1.5254,1.2050,1.3123,1.1084,1.4951,1.4321,1.4904,1.9157,1.5322,0.9428,1.9401,4.9855,1.6328,2.0057,1.0344,1.4764 -2022,1.0897,1.0022,1.4558,1.6381,1.6487,1.1934,1.6102,1.3024,1.3655,1.1208,1.6215,1.4756,1.5357,2.0222,1.6174,0.9967,2.0378,4.1534,1.7669,0.3062,1.0573,1.5326 -2023,1.0980,1.0051,1.5019,1.7037,1.7513,1.2424,1.4167,1.3646,1.3780,1.1334,1.7027,1.5299,1.5921,1.7792,1.4230,1.1791,2.0861,3.6288,1.9086,0.2293,1.1231,1.5909 -2024,1.1062,1.0075,1.5468,1.7781,1.8329,1.0901,1.4282,1.4060,1.3183,1.1461,1.7836,1.6034,1.6687,1.7935,1.4345,1.2842,2.0790,3.3456,2.0372,0.2617,1.1754,1.6514 -2025,1.1142,1.0101,1.5935,1.8654,1.9106,0.9656,1.5778,1.4366,1.3355,1.1589,1.8706,1.6856,1.7542,1.9815,1.5849,1.3328,2.1186,3.2086,2.1646,0.2827,1.2252,1.7143 -2026,1.1222,1.0124,1.6377,1.9502,1.9997,0.8834,1.6849,1.4660,1.3520,1.1719,1.9516,1.7741,1.8463,2.1159,1.6924,1.4279,2.1945,3.1399,2.2989,0.3076,1.2824,1.7795 -2027,1.1301,1.0143,1.6790,2.0346,2.0875,0.8318,1.7822,1.4962,1.3690,1.1850,2.0263,1.8602,1.9359,2.2382,1.7902,1.5245,2.2892,3.1309,2.4381,0.3334,1.3387,1.8472 -2028,1.1379,1.0163,1.7188,2.1165,2.1774,0.8013,1.8521,1.5287,1.3872,1.1983,2.1041,1.9470,2.0262,2.3259,1.8603,1.6021,2.3880,3.1591,2.5877,0.3634,1.3963,1.9175 -2029,1.1455,1.0198,1.7569,2.1999,2.2686,0.7828,1.9137,1.5634,1.4067,1.2117,2.1851,2.0354,2.1182,2.4033,1.9222,1.6691,2.4830,3.2174,2.7425,0.3870,1.4548,1.9904 -2030,1.1530,1.0233,1.7915,2.2856,2.3637,0.7735,1.9802,1.5989,1.4267,1.2252,2.2682,2.1247,2.2111,2.4868,1.9890,1.7382,2.5799,3.2986,2.9018,0.4017,1.5158,2.0662 -2031,1.1603,1.0266,1.8190,2.3735,2.4611,0.7695,2.0499,1.6354,1.4472,1.2390,2.3533,2.2148,2.3049,2.5744,2.0591,1.8050,2.6790,3.3954,3.0652,0.4153,1.5783,2.1448 -2032,1.1675,1.0301,1.8433,2.4633,2.5644,0.7695,2.1253,1.6723,1.4679,1.2528,2.4397,2.3066,2.4004,2.6691,2.1348,1.8750,2.7803,3.5037,3.0652,0.4269,1.6445,2.2264 -2033,1.1745,1.0337,1.8659,2.5548,2.6695,0.7722,2.2006,1.7105,1.4894,1.2669,2.5274,2.3991,2.4967,2.7637,2.2104,1.9512,2.8837,3.6204,3.0652,0.4269,1.7119,2.3111 +2021,1.0814,0.9992,1.4092,1.5025,1.6130,0.6795,1.5254,1.2050,1.3123,1.1084,1.4951,1.4321,1.4904,1.9157,1.5322,0.9428,1.9401,5.0813,1.6328,2.0057,1.0344,1.4764 +2022,1.0897,1.0022,1.4558,1.6381,1.6487,1.1934,1.6102,1.3024,1.3652,1.1208,1.6215,1.4756,1.5357,2.0222,1.6174,0.9967,2.0378,3.2338,1.7669,0.3062,1.0573,1.5326 +2023,1.0980,1.0051,1.5019,1.7619,1.7445,0.7854,1.7702,1.3548,1.3717,1.1334,1.7156,1.5064,1.5677,2.2231,1.7781,1.0306,2.3135,3.4295,1.9787,0.2293,1.1187,1.5909 +2024,1.1062,1.0075,1.5468,1.8313,1.8388,0.7086,1.7962,1.3900,1.3910,1.1461,1.7982,1.5779,1.6420,2.2558,1.8042,1.2003,2.3845,3.2211,2.1457,0.3067,1.1792,1.6514 +2025,1.1142,1.0101,1.5935,1.9052,1.9270,0.6874,1.8462,1.4246,1.3335,1.1589,1.8818,1.6492,1.7163,2.3185,1.8544,1.3199,2.4627,3.1713,2.2806,0.3542,1.2357,1.7143 +2026,1.1222,1.0124,1.6377,1.9856,2.0171,0.6834,1.8868,1.4580,1.3522,1.1719,1.9635,1.7238,1.7939,2.3695,1.8952,1.4599,2.5295,3.0990,2.4165,0.3667,1.2936,1.7795 +2027,1.1301,1.0143,1.6790,2.0670,2.1067,0.6874,1.9334,1.4900,1.3702,1.1850,2.0437,1.7952,1.8682,2.4281,1.9421,1.5681,2.5811,3.1012,2.5562,0.3834,1.3510,1.8472 +2028,1.1379,1.0163,1.7188,2.1505,2.1993,0.6967,1.9934,1.5225,1.3885,1.1983,2.1258,1.8647,1.9405,2.5035,2.0023,1.6590,2.6549,3.1512,2.7043,0.4001,1.4104,1.9175 +2029,1.1455,1.0198,1.7569,2.2370,2.2935,0.7086,2.0632,1.5562,1.4074,1.2117,2.2114,1.9351,2.0138,2.5910,2.0724,1.7204,2.7584,3.2324,2.8573,0.4184,1.4708,1.9904 +2030,1.1530,1.0233,1.7915,2.3260,2.3926,0.7205,2.1268,1.5909,1.4269,1.2252,2.2998,2.0073,2.0890,2.6710,2.1363,1.7957,2.8679,3.3334,3.0138,0.4367,1.5343,2.0662 +2031,1.1603,1.0266,1.8190,2.4176,2.4953,0.7325,2.1932,1.6265,1.4469,1.2390,2.3903,2.0831,2.1679,2.7543,2.2030,1.8779,2.9807,3.4479,3.1722,0.4534,1.6002,2.1448 +2032,1.1675,1.0301,1.8433,2.5119,2.6022,0.7444,2.2686,1.6634,1.4676,1.2528,2.4824,2.1638,2.2518,2.8490,2.2787,1.9654,3.0970,3.5724,3.3317,0.4676,1.6687,2.2264 +2033,1.1745,1.0337,1.8659,2.6091,2.7115,0.7550,2.3464,1.7008,1.4886,1.2669,2.5759,2.2507,2.3423,2.9467,2.3568,2.0398,3.2167,3.7045,3.4992,0.4809,1.7388,2.3111 +2034,1.1813,1.0370,1.8889,2.7089,2.8237,0.7656,2.4301,1.7390,1.5101,1.2810,2.6709,2.3391,2.4342,3.0518,2.4409,2.1072,3.3396,3.8426,3.6751,0.4951,1.8108,2.3990 diff --git a/puf_stage1/factors_finalprep.py b/puf_stage1/factors_finalprep.py index 26f7ac0f..cd6ffd70 100644 --- a/puf_stage1/factors_finalprep.py +++ b/puf_stage1/factors_finalprep.py @@ -2,6 +2,7 @@ Transform Stage_I_factors.csv (written by the stage1.py script) and benefit_growth_rates.csv into growfactors.csv (used by Tax-Calculator). """ + import pandas as pd import os diff --git a/puf_stage1/growfactors.csv b/puf_stage1/growfactors.csv index 4d7396f9..02d28af7 100644 --- a/puf_stage1/growfactors.csv +++ b/puf_stage1/growfactors.csv @@ -9,16 +9,17 @@ YEAR,ATXPY,ASCHF,ABOOK,ACPIU,ACPIM,AWAGE,ASCHCI,ASCHCL,ASCHEI,ASCHEL,AINTS,ADIVS 2018,1.042394,0.976786,1.074059,1.0245,1.019707,1.041821,1.042769,1.042713,1.074048,1.074033,1.031272,1.076804,1.074755,1.018778,0.92284,1.050825,1.103035,1.045097,1.045897,1.005738,1,1.002574,1.034828,1,1 2019,1.032351,0.979401,1.019085,1.017913,1.028328,1.039292,1.004274,1.004387,1.019131,1.019122,1.014806,1.041751,0.925878,1.031182,0.940635,1.040577,1.054052,1.052158,1.045866,1.000751,1,1.002567,1.034809,1,1 2020,1.067957,1.167938,0.947032,1.012495,1.041121,1.006381,1.016054,1.015991,0.947016,0.94708,0.989319,1.091767,1.292516,1.023383,1.034222,1.076313,0.996727,1.050763,1.046106,1.00255,1,1.003841,1.034974,1,1 -2021,1.065517,1.126248,1.216697,1.047189,1.012343,1.079707,1.057058,1.05708,1.216716,1.216644,0.999214,1.057982,1.758329,1.011965,8.619252,1.073809,1.03007,1.047248,1.047927,1.001796,1,1.002551,1.034869,1,1 -2022,1.014347,1.742914,1.047552,1.08083,1.04054,1.076282,1.022527,1.022546,1.047553,1.047566,1.049118,1.042358,0.82675,1.04749,0.152665,1.022138,1.030159,1.048769,1.047573,0.999851,1,1.002545,1.034942,1,1 -2023,1.054201,1.03319,0.873178,1.047758,1.009154,1.042139,1.028961,1.028889,0.873183,0.873156,1.174061,1.015964,0.867089,1.047041,0.748857,1.062234,1.030193,1.050822,1.048715,1.000448,1,1.003807,1.034968,1,1 -2024,1.038836,0.870911,1.000645,1.030339,0.956676,1.039748,1.040273,1.040343,1.000565,1.000609,1.081062,0.989209,0.915123,1.036396,1.1413,1.046568,1.030334,1.048426,1.051767,0.99776,1,1.002528,1.034951,1,1 -2025,1.034907,0.87943,1.096815,1.021764,1.013047,1.041247,1.043718,1.04369,1.09689,1.096912,1.030393,1.011731,0.952165,1.031398,1.080245,1.042369,1.030635,1.046248,1.052213,1.002245,1,1.003783,1.034897,1,1 -2026,1.039173,0.90835,1.060267,1.020465,1.012355,1.035864,1.045,1.044999,1.060215,1.060215,1.063716,1.028441,0.971613,1.03338,1.088079,1.046686,1.030633,1.072236,1,0.999552,1,1.002513,1.034808,1,1 -2027,1.036609,0.935007,1.050354,1.0206,1.012574,1.031018,1.041202,1.0412,1.050406,1.050393,1.060188,1.035861,0.990163,1.034463,1.083875,1.043902,1.030788,1,1,1,1,1.002506,1.034863,1,1 -2028,1.035916,0.956729,1.032098,1.021722,1.013294,1.031277,1.039487,1.039471,1.03206,1.032034,1.043698,1.036009,1.002091,1.036783,1.089982,1.043027,1.030942,1,1,1,1,1,1,1,1 -2029,1.034972,0.970431,1.026404,1.022699,1.014057,1.031606,1.038467,1.038469,1.026422,1.026419,1.034908,1.032884,1.011698,1.036838,1.064942,1.041896,1.031131,1,1,1,1,1,1,1,1 -2030,1.035143,0.981692,1.028019,1.022707,1.014218,1.031278,1.037083,1.037068,1.028013,1.028021,1.034625,1.032267,1.018569,1.03765,1.037984,1.04193,1.03133,1,1,1,1,1,1,1,1 -2031,1.034656,0.98857,1.028686,1.022828,1.014369,1.030991,1.035848,1.035864,1.028713,1.028731,1.031897,1.031879,1.02287,1.04034,1.033856,1.041232,1.03151,1,1,1,1,1,1,1,1 -2032,1.035547,0.993833,1.030388,1.022563,1.014303,1.030321,1.035026,1.035011,1.030391,1.03037,1.032375,1.031412,1.025532,0.986817,1.027932,1.041944,1.031644,1,1,1,1,1,1,1,1 -2033,1.03478,0.997528,1.029259,1.022843,1.014647,1.029773,1.033903,1.033919,1.029271,1.029242,1.034438,1.031009,1.027149,0.987888,1,1.040985,1.031857,1,1,1,1,1,1,1,1 \ No newline at end of file +2021,1.065517,1.126248,1.216697,1.047189,1.012343,1.079707,1.057058,1.05708,1.216716,1.216644,0.999214,1.057982,1.792117,1.011965,8.619252,1.073809,1.03007,1.047248,1.047927,1.001796,1,1.002551,1.034869,1,1 +2022,1.014347,1.742914,1.047552,1.08083,1.040311,1.076282,1.022527,1.022546,1.047553,1.047566,1.049118,1.042358,0.631565,1.04749,0.152665,1.022138,1.030159,1.048769,1.047573,0.999851,1,1.002545,1.034942,1,1 +2023,1.050108,0.653145,1.091056,1.040233,1.004761,1.050035,1.013156,1.013121,1.091037,1.091047,1.026196,1.126711,1.0525,1.085497,0.748857,1.058072,1.030193,1.050822,1.048715,1.000448,1,1.003807,1.034968,1,1 +2024,1.046242,0.895528,1.007166,1.025982,1.01407,1.040377,1.0397,1.03963,1.007187,1.007157,1.156028,1.023049,0.932271,1.052921,1.337549,1.054081,1.030334,1.048426,1.051767,0.99776,1,1.002528,1.034951,1,1 +2025,1.040442,0.963117,1.020457,1.024892,0.958663,1.038977,1.037682,1.037745,1.020415,1.020444,1.091746,1.02538,0.97747,1.031721,1.154874,1.047914,1.030635,1.046248,1.052213,1.002245,1,1.003783,1.034897,1,1 +2026,1.039294,0.987094,1.014705,1.023445,1.014023,1.035978,1.037783,1.037762,1.014711,1.014716,1.098184,1.019802,0.970235,1.030992,1.035291,1.046856,1.030633,1.072236,1,0.999552,1,1.002513,1.034808,1,1 +2027,1.037119,0.998822,1.017535,1.021948,1.013312,1.033569,1.03414,1.034138,1.017568,1.017583,1.066606,1.013266,0.993714,1.031791,1.045541,1.044372,1.030788,1,1,1,1,1.002506,1.034863,1,1 +2028,1.036799,1.006582,1.023966,1.021812,1.013356,1.033042,1.031594,1.03158,1.023985,1.02393,1.050716,1.021542,1.009158,1.03344,1.043558,1.043967,1.030942,1,1,1,1,1,1,1,1 +2029,1.035913,1.010333,1.028149,1.022135,1.013612,1.033365,1.030869,1.030888,1.028085,1.028143,1.03013,1.032091,1.018962,1.033664,1.045739,1.042825,1.031131,1,1,1,1,1,1,1,1 +2030,1.036423,1.01018,1.024121,1.022298,1.013855,1.03321,1.030563,1.030595,1.02417,1.024128,1.036979,1.032934,1.024538,1.034401,1.043738,1.043174,1.03133,1,1,1,1,1,1,1,1 +2031,1.036362,1.010259,1.024733,1.022377,1.014016,1.032812,1.031233,1.03124,1.024699,1.024734,1.039197,1.032793,1.027842,1.036645,1.038241,1.042951,1.03151,1,1,1,1,1,1,1,1 +2032,1.036409,1.009979,1.028,1.022687,1.014306,1.032126,1.032334,1.032295,1.028004,1.027983,1.04014,1.03261,1.029719,1.036435,1.031319,1.042807,1.031644,1,1,1,1,1,1,1,1 +2033,1.035793,1.008195,1.02813,1.022484,1.014309,1.031481,1.033961,1.033991,1.028128,1.02811,1.031669,1.03246,1.030798,1.037554,1.028443,1.042009,1.031857,1,1,1,1,1,1,1,1 +2034,1.035385,1.008203,1.02971,1.02246,1.014443,1.030912,1.033294,1.033253,1.029705,1.029722,1.027096,1.032231,1.031308,1.03748,1.029528,1.041408,1.032059,1,1,1,1,1,1,1,1 \ No newline at end of file diff --git a/puf_stage1/stage1.py b/puf_stage1/stage1.py index 3d19324c..f3664838 100644 --- a/puf_stage1/stage1.py +++ b/puf_stage1/stage1.py @@ -4,7 +4,7 @@ CUR_PATH = os.path.abspath(os.path.dirname(__file__)) SYR = 2011 # calendar year used to normalize factors BEN_SYR = 2014 # calendar year used just for the benefit start year -EYR = 2033 # last calendar year we have data for +EYR = 2034 # last calendar year we have data for SOI_YR = 2017 # most recently available SOI estimates IRS_RET_YR = 2022 # most recently available IRS return projections diff --git a/puf_stage1/updatecbo.py b/puf_stage1/updatecbo.py index 654d1b4f..51990f35 100644 --- a/puf_stage1/updatecbo.py +++ b/puf_stage1/updatecbo.py @@ -5,6 +5,7 @@ there is a bug, it's probably because that assumption no longer holds true. When this happens, modify the code as needed to account for this. """ + import re import requests import pandas as pd @@ -45,8 +46,8 @@ def update_cpim(baseline, text_args): # convert the values to floats so that the groupby mean only returns # the mean for the value df["value"] = df["value"].astype(float) - cpi_mean = df.groupby("year").mean().transpose().round(1) - cpi_mean.index = ["CPIM"] + cpi_mean = df.groupby("year")["value"].mean().round(1) + cpi_mean = cpi_mean.to_frame(name="CPIM").transpose() # open the current baseline to replace the values for the years pulled # from BLS @@ -97,9 +98,10 @@ def update_econproj(url, baseline, text_args): r = session.get(url) cbo_pre_url = "https://www.cbo.gov" divs = r.html.find("div.view.view-recurring-data") - revprojections = divs[4] + # both assertions are there to throw errors if the order of sections change # revenue projections used for capital gains projections + revprojections = divs[4] assert "Revenue Projections" in revprojections.text latest_revprojections = revprojections.find("div.views-col.col-1")[0] rev_link = latest_revprojections.find("a")[0] @@ -109,7 +111,7 @@ def update_econproj(url, baseline, text_args): rev_url = "".join([cbo_pre_url, rev_file_url]) econprojections = divs[8] - assert "10-Year Economic Projections" in econprojections.text + assert "Economic Projections" in econprojections.text latest_econprojections = econprojections.find("div.views-col.col-1")[0] econ_link = latest_econprojections.find("a")[0] _cbo_report = datetime.strptime(econ_link.text, "%b %Y") @@ -127,24 +129,25 @@ def update_econproj(url, baseline, text_args): # extract values for needed rows in the excel file # some variables have a missing value in the multi-index. Use iloc # to extract needed variables from them. - gdp = econ_proj.loc["Output"].loc["Gross Domestic Product (GDP)"].iloc[0] - income = econ_proj.loc["Income"] - tpy = income.loc["Income, Personal"].iloc[0] - wages = income.loc["Wages and Salaries"].iloc[0] billions = "Billions of dollars" + gdp = econ_proj.loc["Gross domestic product (GDP)"].loc[billions].iloc[0] + tpy = econ_proj.loc["Income, personal"].loc[billions].iloc[0] + wages = econ_proj.loc["Wages and salaries"].loc[billions].iloc[0] var = "Proprietors' income, nonfarm, with IVA & CCAdj" - schc = income.loc["Nonwage Income"].loc[var].loc[billions] + schc = econ_proj.loc[var].loc[billions].iloc[0] var = "Proprietors' income, farm, with IVA & CCAdj" - schf = income.loc["Nonwage Income"].loc[var].loc[billions] + schf = econ_proj.loc[var].loc[billions].iloc[0] var = "Interest income, personal" - ints = income.loc["Nonwage Income"].loc[var].loc[billions] + ints = econ_proj.loc[var].loc[billions].iloc[0] var = "Dividend income, personal" - divs = income.loc["Nonwage Income"].loc[var].loc[billions] + divs = econ_proj.loc[var].loc[billions].iloc[0] var = "Income, rental, with CCAdj" - rents = income.loc["Nonwage Income"].loc[var].loc[billions] - book = income.loc["Profits, Corporate, With IVA & CCAdj"].iloc[0] - var = "Consumer Price Index, All Urban Consumers (CPI-U)" - cpiu = econ_proj.loc["Prices"].loc[var].iloc[0] + rents = econ_proj.loc[var].loc[billions].iloc[0] + book = ( + econ_proj.loc["Profits, corporate, with IVA & CCAdj"].loc[billions].iloc[0] + ) + var = "Consumer price index, all urban consumers (CPI-U)" + cpiu = econ_proj.loc[var].loc["1982-1984 = 100"].iloc[0] var_list = [gdp, tpy, wages, schc, schf, ints, divs, rents, book, cpiu] var_names = [ "GDP", @@ -191,10 +194,10 @@ def update_econproj(url, baseline, text_args): header=[0, 1], ) cg_proj.index = cg_proj[cg_proj.columns[0]] - var = "Capital Gains Realizationsa" + var = "Capital gains realizationsa" # increase the CBO final year to (the last year + 1) for each update. - # e.g. when the CBO final year from CBO is 2033, make the update as range(2017,2034) - cgns = cg_proj[var]["Billions of Dollars"].loc[list(range(2017, 2034))] + # e.g. when the CBO final year from CBO is 2034, make the update as range(2017,2035) + cgns = cg_proj[var]["Billions of dollars"].loc[list(range(2017, 2035))] var_list = [cgns] var_names = ["CGNS"] df = pd.DataFrame(var_list, index=var_names).round(1) @@ -236,8 +239,11 @@ def update_socsec(url, baseline, text_args): r = session.get(url) # we can determine the latest year by looking at all of the years availeble # in the first drop down and adding one. - selector = r.html.find("select#yh1")[0] - latest_yr = max([int(yr) for yr in selector.text.split()]) + 1 + # selector = r.html.find("select#yh1")[0] + + # check https://www.ssa.gov/oact/TR/ for the latest year + latest_yr = 2023 + # latest_yr = max([int(yr) for yr in selector.text.split()]) + 1 report = f"{latest_yr} Report" if report == text_args["socsec_cur_report"]: print("\tNo new data since last update") @@ -248,7 +254,7 @@ def update_socsec(url, baseline, text_args): html = pd.read_html(socsec_url, match=match_txt)[0] # merge the columns with years and data into one sub_data = pd.concat( - [html["Fiscal year", "Fiscal year.1"], html["Cost", "Sched-uled benefits"]], + [html["Fiscal year", "Fiscal year.1"], html["Cost", "Scheduled benefits"]], axis=1, ) sub_data.columns = ["year", "cost"] @@ -321,6 +327,7 @@ def update_rets(url, baseline, text_args): pct_change = projections.pct_change() + 1 # extrapolate out to final year of other CBO projections factor = pct_change.iloc[-1] + projections.index = projections.index.astype(int) last_year = int(max(projections.index)) cbo_last_year = int(max(baseline.columns)) df_projections = pd.DataFrame(projections).transpose() @@ -365,6 +372,8 @@ def update_ucomp(url, baseline, text_args): ucomp_years.append(datetime.strptime(date, "%Y-%m")) latest_year = max(ucomp_years) ucomp_url = ucomp_links[ucomp_years.index(latest_year)] + CBO_url = "https://www.cbo.gov" + ucomp_url = CBO_url + ucomp_url report = datetime.strftime(latest_year, "%B %Y") if report == text_args["ucomp_cur_report"]: print("\tNo new data since last update") @@ -372,13 +381,18 @@ def update_ucomp(url, baseline, text_args): elif report == "February 2021": print("Latest data is from pandemic. Enter by hand") return baseline, text_args - data = pd.read_excel(ucomp_url, skiprows=3, index_col=0, thousands=",") + data = pd.read_excel(ucomp_url, skiprows=7, index_col=[0, 1, 2], thousands=",") try: benefits = data.loc["Budget Authority"].dropna().astype(int) / 1000 except KeyError: benefits = data.loc["Budget Authority"].dropna().astype(int) / 1000 benefits = benefits.round(1) df = pd.DataFrame(benefits).transpose() + # drop items whose index are not years + for indx in df.index: + if type(indx) != int: + df = df.drop(indx) + df = pd.DataFrame(df.values, index=df.index).transpose() df.index = ["UCOMP"] df.columns = df.columns.astype(str) baseline.update(df) diff --git a/puf_stage2/puf_weights.csv.gz b/puf_stage2/puf_weights.csv.gz index 852a3658..65bed1d7 100644 Binary files a/puf_stage2/puf_weights.csv.gz and b/puf_stage2/puf_weights.csv.gz differ diff --git a/puf_stage2/solver.jl b/puf_stage2/solver.jl index 9362b4b4..46852251 100644 --- a/puf_stage2/solver.jl +++ b/puf_stage2/solver.jl @@ -82,12 +82,12 @@ function Solve_func(year, tol) end -year_list = [x for x in 2012:2033] +year_list = [x for x in 2012:2034] tol_list = [0.40, 0.38, 0.35, 0.33, 0.30, 0.45, 0.45, 0.45, 0.45, 0.45, 0.45, 0.45, 0.45, 0.45, 0.45, 0.45, 0.45, 0.45, 0.45, 0.45, - 0.45, 0.5] + 0.45, 0.5, 0.5] # Run solver function for all years and tolerances (in order) for i in zip(year_list, tol_list) diff --git a/puf_stage2/stage2.py b/puf_stage2/stage2.py index e3179fe7..b0ae1900 100644 --- a/puf_stage2/stage2.py +++ b/puf_stage2/stage2.py @@ -56,7 +56,7 @@ puf.s006 = puf.matched_weight * 100 # Dataprep -year_list = [x for x in range(2012, 2033 + 1)] +year_list = [x for x in range(2012, 2034 + 1)] skipped_years = [] for i in year_list: try: diff --git a/puf_stage3/puf_ratios.csv b/puf_stage3/puf_ratios.csv index 008660ed..cc1c3e06 100644 --- a/puf_stage3/puf_ratios.csv +++ b/puf_stage3/puf_ratios.csv @@ -10,15 +10,16 @@ INT2018,0.9991,0.9744,0.9683,0.9667,0.9757,0.9725,0.9747,0.9779,0.9742,0.9969,0. INT2019,0.9979,0.9771,0.9763,0.9903,0.9793,0.9805,0.9769,0.9852,0.9826,0.9938,0.9934,1.0109,1.0020,1.0074,0.9983,1.0006,1.0253,1.0282,1.0196 INT2020,1.0017,0.9799,0.9740,0.9756,0.9843,0.9849,0.9831,0.9833,0.9931,0.9964,0.9958,1.0114,1.0058,1.0047,1.0078,0.9991,1.0129,1.0113,1.0113 INT2021,0.9959,0.9797,0.9776,0.9780,0.9834,0.9898,0.9883,0.9869,0.9920,0.9978,1.0043,0.9974,1.0066,1.0119,1.0049,1.0040,1.0303,1.0085,1.0022 -INT2022,1.0062,0.9815,0.9810,0.9783,0.9727,0.9820,0.9851,0.9893,0.9934,1.0049,1.0022,1.0050,1.0029,1.0042,1.0047,1.0044,1.0133,0.9989,1.0111 -INT2023,0.9983,0.9812,0.9761,0.9789,0.9890,0.9893,0.9851,1.0197,0.9942,0.9956,1.0022,1.0012,1.0023,1.0074,1.0006,1.0093,1.0214,1.0021,0.9943 -INT2024,1.0016,0.9842,0.9813,0.9791,0.9711,0.9789,0.9892,1.0102,0.9906,0.9984,0.9987,0.9971,1.0048,1.0077,1.0089,1.0075,1.0238,1.0147,1.0081 -INT2025,1.0086,0.9935,0.9773,0.9768,0.9835,0.9817,1.0013,0.9942,0.9934,1.0007,0.9992,0.9979,1.0047,1.0074,1.0143,1.0151,1.0239,0.9942,0.9913 -INT2026,1.0088,0.9842,0.9791,0.9795,0.9871,0.9903,1.0007,0.9908,0.9952,0.9939,0.9929,0.9931,1.0072,1.0142,1.0372,1.0249,1.0206,0.9992,0.9936 -INT2027,1.0116,0.9889,0.9840,0.9806,0.9889,0.9907,0.9806,0.9952,0.9907,0.9945,0.9992,0.9914,1.0074,1.0185,1.0175,1.0277,1.0259,0.9932,0.9947 -INT2028,1.0062,0.9977,0.9772,0.9828,0.9863,0.9876,1.0107,0.9956,0.9923,0.9954,0.9935,0.9920,1.0068,1.0177,1.0271,1.0219,1.0222,0.9963,0.9918 -INT2029,1.0107,0.9939,0.9780,0.9801,0.9823,0.9852,1.0025,0.9850,0.9945,0.9933,0.9932,0.9929,1.0033,1.0282,1.0278,1.0474,1.0235,1.0009,0.9925 -INT2030,1.0289,1.0010,0.9821,0.9840,0.9821,0.9917,0.9823,0.9877,0.9826,0.9890,0.9815,0.9919,1.0055,1.0363,1.0382,1.0449,1.0301,0.9951,0.9921 -INT2031,1.0279,1.0213,0.9858,0.9918,0.9829,0.9886,0.9858,0.9770,0.9914,0.9938,0.9794,0.9871,0.9953,1.0447,1.0439,1.0732,1.0284,1.0061,0.9932 -INT2032,1.0080,1.1006,0.9919,0.9812,0.9867,0.9850,0.9881,0.9740,0.9732,0.9791,0.9656,0.9835,0.9900,1.0785,1.0904,1.1373,1.0484,1.0099,0.9983 -INT2033,0.9351,0.8350,0.9708,0.9751,0.9896,0.9850,0.9879,1.0383,1.0312,1.0351,1.1160,1.0744,1.0375,0.8505,0.8247,0.7425,0.8975,1.0567,1.0931 +INT2022,1.0062,0.9815,0.9810,0.9783,0.9727,0.9820,0.9851,0.9893,0.9934,1.0049,1.0022,1.0050,1.0029,1.0042,1.0047,1.0044,1.0133,0.9988,1.0111 +INT2023,0.9987,0.9812,0.9762,0.9787,0.9892,0.9893,0.9852,1.0191,0.9939,0.9956,1.0023,1.0012,1.0024,1.0074,1.0006,1.0093,1.0215,1.0022,0.9943 +INT2024,1.0009,0.9842,0.9813,0.9793,0.9709,0.9789,0.9892,1.0104,0.9909,0.9984,0.9987,0.9971,1.0049,1.0077,1.0093,1.0079,1.0238,1.0149,1.0081 +INT2025,1.0089,0.9935,0.9773,0.9768,0.9835,0.9817,1.0012,0.9946,0.9933,1.0008,0.9989,0.9979,1.0050,1.0073,1.0138,1.0146,1.0238,0.9939,0.9912 +INT2026,1.0088,0.9842,0.9792,0.9795,0.9871,0.9904,1.0008,0.9908,0.9953,0.9938,0.9932,0.9931,1.0068,1.0143,1.0372,1.0249,1.0207,0.9992,0.9936 +INT2027,1.0116,0.9889,0.9840,0.9806,0.9889,0.9908,0.9806,0.9952,0.9906,0.9945,0.9993,0.9913,1.0074,1.0185,1.0175,1.0278,1.0260,0.9932,0.9947 +INT2028,1.0062,0.9977,0.9772,0.9829,0.9863,0.9876,1.0107,0.9957,0.9924,0.9955,0.9930,0.9921,1.0068,1.0177,1.0271,1.0218,1.0222,0.9964,0.9918 +INT2029,1.0107,0.9938,0.9779,0.9803,0.9824,0.9851,1.0024,0.9850,0.9944,0.9933,0.9936,0.9928,1.0032,1.0281,1.0277,1.0472,1.0235,1.0010,0.9924 +INT2030,1.0288,1.0010,0.9821,0.9838,0.9820,0.9917,0.9823,0.9877,0.9829,0.9890,0.9815,0.9920,1.0054,1.0363,1.0382,1.0450,1.0301,0.9950,0.9921 +INT2031,1.0279,1.0213,0.9858,0.9918,0.9829,0.9887,0.9858,0.9770,0.9911,0.9938,0.9791,0.9871,0.9955,1.0446,1.0440,1.0735,1.0287,1.0061,0.9932 +INT2032,1.0080,1.1016,0.9920,0.9811,0.9868,0.9849,0.9882,0.9740,0.9733,0.9790,0.9655,0.9835,0.9897,1.0788,1.0905,1.1376,1.0484,1.0100,0.9984 +INT2033,0.9352,0.8342,0.9707,0.9751,0.9895,0.9850,0.9878,1.0382,1.0312,1.0352,1.1164,1.0745,1.0376,0.8503,0.8245,0.7421,0.8973,1.0566,1.0930 +INT2034,1.0278,0.9998,0.9801,0.9801,0.9905,0.9878,0.9984,0.9804,0.9885,0.9931,0.9775,0.9843,1.0026,1.0381,1.0368,1.0580,1.0407,1.0028,0.9939 diff --git a/puf_stage3/stage3.py b/puf_stage3/stage3.py index 3f285f57..315d4ed9 100644 --- a/puf_stage3/stage3.py +++ b/puf_stage3/stage3.py @@ -6,7 +6,7 @@ CUR_PATH = os.path.abspath(os.path.dirname(__file__)) start_year = 2011 -end_year = 2033 +end_year = 2034 def adjustment(agi, var, var_name, target, weights, blowup): diff --git a/taxdata/cps/cps_meta.py b/taxdata/cps/cps_meta.py index 0ba3f31d..ca1f950c 100644 --- a/taxdata/cps/cps_meta.py +++ b/taxdata/cps/cps_meta.py @@ -1,6 +1,7 @@ """ Holds all the CPS file metadata we need. Created to keep create.py clean """ + C_TAM_YEARS = [2013, 2014, 2015] # years we have C-TAM imputations for CPS_META_DATA = { diff --git a/taxdata/cps/finalprep.py b/taxdata/cps/finalprep.py index ec15f732..4b2c23a0 100644 --- a/taxdata/cps/finalprep.py +++ b/taxdata/cps/finalprep.py @@ -1,6 +1,7 @@ """ Clean up the CPS file and make it ready for Tax-Calculator """ + import numpy as np import pandas as pd import copy diff --git a/taxdata/cps/splitincome.py b/taxdata/cps/splitincome.py index 285c32d8..901794fb 100644 --- a/taxdata/cps/splitincome.py +++ b/taxdata/cps/splitincome.py @@ -1,6 +1,7 @@ """ Split up certain income variables """ + import numpy as np diff --git a/taxdata/cps/targeting.py b/taxdata/cps/targeting.py index 6e4ba557..d19cdee8 100644 --- a/taxdata/cps/targeting.py +++ b/taxdata/cps/targeting.py @@ -1,6 +1,7 @@ """ State level targeting of certain income variables """ + import pandas as pd import numpy as np from .constants import FIPS_DICT diff --git a/taxdata/cps/transform_sas.py b/taxdata/cps/transform_sas.py index 1e0ad47c..44d3eaa3 100644 --- a/taxdata/cps/transform_sas.py +++ b/taxdata/cps/transform_sas.py @@ -2,6 +2,7 @@ Scripts to convert the SAS scripts used to process the .DAT format CPS file to Python """ + import pickle from pathlib import Path from .cps_meta import CPS_META_DATA diff --git a/taxdata/puf/impute_itmexp.py b/taxdata/puf/impute_itmexp.py index 1a5a44df..375be343 100644 --- a/taxdata/puf/impute_itmexp.py +++ b/taxdata/puf/impute_itmexp.py @@ -32,6 +32,7 @@ Non-Itemizers, 2011." (Comments below contain more detail on this procedure.) """ + from __future__ import print_function import numpy as np import pandas as pd diff --git a/taxdata/puf/impute_pencon.py b/taxdata/puf/impute_pencon.py index 40cbdea4..36d886ba 100644 --- a/taxdata/puf/impute_pencon.py +++ b/taxdata/puf/impute_pencon.py @@ -38,6 +38,7 @@ process twice. See the impute_pension_contributions() function code for details. """ + from __future__ import print_function import sys import numpy as np diff --git a/taxdata/puf/preppuf.py b/taxdata/puf/preppuf.py index f721c756..ec7a4b44 100644 --- a/taxdata/puf/preppuf.py +++ b/taxdata/puf/preppuf.py @@ -1,6 +1,7 @@ """ Scripts to clean up the raw PUF before matching """ + import numpy as np # RECIDs for aggregate variables by PUF year diff --git a/tests/test_data.py b/tests/test_data.py index 4f7bf86e..70450c81 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -1,6 +1,7 @@ """ Test CPS and PUF data file contents. """ + import os import pytest import numpy as np diff --git a/tests/test_ratios.py b/tests/test_ratios.py index 4fcda353..c53aceee 100644 --- a/tests/test_ratios.py +++ b/tests/test_ratios.py @@ -1,6 +1,7 @@ """ Test PUF adjust-ratio file contents. """ + import pytest diff --git a/tests/test_weights.py b/tests/test_weights.py index cd41a20e..adb09bb9 100644 --- a/tests/test_weights.py +++ b/tests/test_weights.py @@ -1,6 +1,7 @@ """ Test CPS and PUF weights file contents. """ + import pytest import numpy as np