Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions tests/expected_tax_exp_2022_data
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
YR,KIND,EST= 2023 paytax 1421.4
YR,KIND,EST= 2023 iitax 2201.0
YR,KIND,EST= 2023 ctc 117.7
YR,KIND,EST= 2023 eitc 71.4
YR,KIND,EST= 2023 paytax 1429.6
YR,KIND,EST= 2023 iitax 2339.4
YR,KIND,EST= 2023 ctc 117.9
YR,KIND,EST= 2023 eitc 70.7
YR,KIND,EST= 2023 social_security_partial_taxability 46.8
YR,KIND,EST= 2023 niit -43.5
YR,KIND,EST= 2023 cgqd_tax_preference 167.8
YR,KIND,EST= 2023 qbid 56.4
YR,KIND,EST= 2023 salt 21.0
YR,KIND,EST= 2023 niit -47.1
YR,KIND,EST= 2023 cgqd_tax_preference 180.1
YR,KIND,EST= 2023 qbid 55.2
YR,KIND,EST= 2023 salt 21.8
20 changes: 10 additions & 10 deletions tests/test_imputed_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ def actual_results(rdf, bdf):
# https://taxpolicycenter.org/taxvox/
# budget-laws-tax-cuts-overtime-and-
# tips-are-popular-few-will-benefit
"exp_totben_2022": 24.38,
"exp_totben_2022": 24.26,
"exp_affpct_2022": 8.77,
"exp_affben_2022": 1399,
"exp_affben_2022": 1403,
},
"TIP": { # new OBBBA tip income deduction
"reform_dict": {"TipIncomeDed_c": {simyear: 0}},
Expand All @@ -72,8 +72,8 @@ def actual_results(rdf, bdf):
# https://taxpolicycenter.org/taxvox/
# budget-laws-tax-cuts-overtime-and-
# tips-are-popular-few-will-benefit
"exp_totben_2022": 7.39,
"exp_affpct_2022": 2.64,
"exp_totben_2022": 7.24,
"exp_affpct_2022": 2.61,
"exp_affben_2022": 1409,
},
"ALI": { # new OBBBA auto loan interest deduction
Expand All @@ -87,9 +87,9 @@ def actual_results(rdf, bdf):
# because the Tax Policy Center did not provide any
# statistics for this new deduction. However, see the
# following reform analysis for FOUR reforms.
"exp_totben_2022": 8.82,
"exp_affpct_2022": 12.66,
"exp_affben_2022": 350,
"exp_totben_2022": 7.75,
"exp_affpct_2022": 12.15,
"exp_affben_2022": 324,
},
"ALL": { # above three deductions plus new OBBBA senior deduction
"reform_dict": {
Expand All @@ -107,9 +107,9 @@ def actual_results(rdf, bdf):
# https://taxpolicycenter.org/model-estimates/T25-0257
# Note that the $1081 TPC estimate is derived by dividing
# the all-unit average of $320 by the 0.296 affpct.
"exp_totben_2022": 63.35,
"exp_affpct_2022": 29.08,
"exp_affben_2022": 1095,
"exp_totben_2022": 61.82,
"exp_affpct_2022": 28.86,
"exp_affben_2022": 1087,
},
}
output_variables = [
Expand Down
4 changes: 2 additions & 2 deletions tmd/areas/create_area_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
import jax.numpy as jnp
from jax.experimental.sparse import BCOO
from tmd.storage import STORAGE_FOLDER
from tmd.imputation_assumptions import TAXYEAR
from tmd.imputation_assumptions import TAXYEAR, POPULATION_FILE
from tmd.areas import AREAS_FOLDER

FIRST_YEAR = TAXYEAR
LAST_YEAR = 2034
INFILE_PATH = STORAGE_FOLDER / "output" / "tmd.csv.gz"
POPFILE_PATH = STORAGE_FOLDER / "input" / "cbo_population_forecast.yaml"
POPFILE_PATH = STORAGE_FOLDER / "input" / POPULATION_FILE

# Tax-Calcultor calculated variable cache files:
TAXCALC_AGI_CACHE = STORAGE_FOLDER / "output" / "cached_c00100.npy"
Expand Down
3 changes: 2 additions & 1 deletion tmd/areas/make_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
)
from tmd.areas import AREAS_FOLDER
from tmd.storage import STORAGE_FOLDER
from tmd.imputation_assumptions import POPULATION_FILE

OTHER_DEPENDENCIES = [
AREAS_FOLDER / "create_area_weights.py",
STORAGE_FOLDER / "output" / "tmd.csv.gz",
STORAGE_FOLDER / "output" / "tmd_weights.csv.gz",
STORAGE_FOLDER / "output" / "tmd_growfactors.csv",
STORAGE_FOLDER / "input" / "cbo_population_forecast.yaml",
STORAGE_FOLDER / "input" / POPULATION_FILE,
# Tax-Calculator is a dependency, so do "make tmd_files" when upgrading T-C
]

Expand Down
15 changes: 9 additions & 6 deletions tmd/create_taxcalc_growth_factors.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,20 @@
ASOCSEC_INDEX = 14
AUCOMP_INDEX = 15


PGFFILE = STORAGE_FOLDER / "input" / "puf_growfactors.csv"
TGFFILE = STORAGE_FOLDER / "output" / "tmd_growfactors.csv"
INPUT_FILE = {
2021: "taxdata25_growfactors.csv",
2022: "taxdata26_growfactors.csv",
}
INFILE = STORAGE_FOLDER / "input" / INPUT_FILE[TAXYEAR]
OUTFILE = STORAGE_FOLDER / "output" / "tmd_growfactors.csv"


def create_factors_file():
"""
Create Tax-Calculator-style factors file for FIRST_YEAR through LAST_YEAR.
"""
# read PUF-factors from PGFFILE
gfdf = pd.read_csv(PGFFILE)
# read PUF-factors from INFILE
gfdf = pd.read_csv(INFILE)
first_puf_year = gfdf.YEAR.iat[0]
last_puf_year = gfdf.YEAR.iat[-1]

Expand Down Expand Up @@ -88,7 +91,7 @@ def create_factors_file():

# write gfdf to CSV-formatted file
gfdf.YEAR = gfdf.YEAR.astype(int)
gfdf.to_csv(TGFFILE, index=False, float_format="%.6f")
gfdf.to_csv(OUTFILE, index=False, float_format="%.6f")


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions tmd/create_taxcalc_sampling_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
import yaml
import pandas as pd
from tmd.storage import STORAGE_FOLDER
from tmd.imputation_assumptions import TAXYEAR
from tmd.imputation_assumptions import TAXYEAR, POPULATION_FILE

FIRST_YEAR = TAXYEAR
LAST_YEAR = TAXYEAR + 53
VARFILE = STORAGE_FOLDER / "output" / "tmd.csv.gz"
POPFILE = STORAGE_FOLDER / "input" / "cbo_population_forecast.yaml"
POPFILE = STORAGE_FOLDER / "input" / POPULATION_FILE
WGTFILE = STORAGE_FOLDER / "output" / "tmd_weights.csv.gz"


Expand Down
18 changes: 12 additions & 6 deletions tmd/imputation_assumptions.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
"""
Central location for data imputation assumptions.
Central location for assumptions about data generation and data imputation.
"""

TAXYEAR = 2022 # single source of truth for the target tax year

IMPUTATION_RF_RNG_SEED = 1928374 # random number seed used by RandomForest

IMPUTATION_BETA_RNG_SEED = 37465 # random number seed used for Beta variates

W2_WAGES_RATIO = { # parameter used to impute pass-through W-2 wages
2021: 0.15,
2022: 0.17,
2022: 0.15,
}

# RNG seeds used for demographic decoding and earnings splits in puf.py:
Expand All @@ -20,7 +19,7 @@
EARN_SPLIT_RNG_SEED = 18374659

ITMDED_GROW_RATE = 0.02 # annual growth rate in itemized deduction amounts
# grow rate applied to inflate 2015 amounts to 2021 amounts in uprate_puf.py
# grow rate applied to inflate 2015 amounts to 2021+ amounts in uprate_puf.py

# parameters used to identify CPS nonfilers:
FILER_MIN_INCOME = {
Expand Down Expand Up @@ -52,11 +51,18 @@

# parameters for MICE imputation of missing OBBBA deduction variables:
# ... overtime_income:
OTM_convert_zero_prob = {2021: 0.077, 2022: 0.077}
OTM_scale = {2021: 2.4, 2022: 2.4}
OTM_convert_zero_prob = {2021: 0.077, 2022: 0.079}
OTM_scale = {2021: 2.4, 2022: 2.3}
# ... tip_income:
TIP_convert_zero_prob = {2021: 0.014, 2022: 0.014}
TIP_scale = {2021: 1.0, 2022: 1.0}
# ... auto_loan_interest:
ALI_convert_zero_prob = {2021: 0.060, 2022: 0.060}
ALI_scale = {2021: 4.0, 2022: 4.0}

# population projection file used to extrapolate TAXYEAR sampling weights
POP_FILE = {
2021: "cbo25_population_forecast.yaml",
2022: "cbo26_population_forecast.yaml",
}
POPULATION_FILE = POP_FILE[TAXYEAR]
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,3 @@
2072: 395.984
2073: 396.650
2074: 397.286
2075: 397.923 # assumed to be equal to 397.286 * (397.286 / 396.650)
73 changes: 73 additions & 0 deletions tmd/storage/input/cbo26_population_forecast.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# SOURCE:
# CBO, "The Demographic Outlook: 2026 to 2056" (January 2026).
# URL: https://www.cbo.gov/publication/61879
# - Data Underlying Figures, Figure 2 spreadsheet tab,
# Total Population (millions) [for years from 2026 through 2075]
# - Demographic Projections, Population and growth spreadsheet tab,
# Total Social Security area population (millions) [for years before 2026]
2010: 313.988
2011: 316.290
2012: 318.428
2013: 320.473
2014: 322.613
2015: 325.590
2016: 328.395
2017: 330.549
2018: 332.731
2019: 334.380
2020: 335.643
2021: 336.687
2022: 338.078
2023: 341.550
2024: 345.440
2025: 348.156
2026: 348.955
2027: 349.838
2028: 350.742
2029: 351.705
2030: 352.726
2031: 353.786
2032: 354.767
2033: 355.671
2034: 356.513
2035: 357.311
2036: 358.084
2037: 358.845
2038: 359.546
2039: 360.191
2040: 360.778
2041: 361.310
2042: 361.787
2043: 362.210
2044: 362.580
2045: 362.900
2046: 363.174
2047: 363.405
2048: 363.593
2049: 363.744
2050: 363.860
2051: 363.947
2052: 364.009
2053: 364.051
2054: 364.076
2055: 364.090
2056: 364.094
2057: 364.093
2058: 364.088
2059: 364.082
2060: 364.075
2061: 364.064
2062: 364.050
2063: 364.033
2064: 364.009
2065: 363.978
2066: 363.934
2067: 363.876
2068: 363.802
2069: 363.708
2070: 363.592
2071: 363.450
2072: 363.279
2073: 363.077
2074: 362.843
2075: 362.577
27 changes: 27 additions & 0 deletions tmd/storage/input/taxdata26_growfactors.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
YEAR,ATXPY,ASCHF,ABOOK,ACPIU,ACPIM,AWAGE,ASCHCI,ASCHCL,ASCHEI,ASCHEL,AINTS,ADIVS,ACGNS,ASOCSEC,AUCOMP,AIPD,ABENOTHER,ABENMCARE,ABENMCAID,ABENSSI,ABENSNAP,ABENWIC,ABENHOUSING,ABENTANF,ABENVET
2011,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
2012,1.043862,0.950283,1.104992,1.0209,1.0367,1.032649,1.049023,0.956138,1.165922,0.926962,0.923588,1.327776,1.58966,1.02827,0.7711,0.9231,0.992359,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
2013,1.012518,1.142179,1.033784,1.014791,1.024597,1.019984,0.99505,1.050098,0.997245,1.013128,0.893658,0.819381,0.776217,1.014786,0.728829,0.896219,0.992515,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
2014,1.029476,0.931683,0.976566,1.015927,1.024007,1.039999,1.040616,1.030349,1.075978,0.991321,0.925886,1.17606,1.387522,1.004801,0.641103,0.970506,0.99257,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
2015,1.043858,0.508206,0.999544,1.001235,1.026386,1.024119,1.038052,1.040061,1.04481,1.057257,1.013311,1.013846,1.004308,1.017188,0.81793,0.988666,1.053858,1.023325,1.041528,1.019361,1.102667,1.007792,1.026748,1.132657,1.04693
2016,1.021978,1.071198,0.984833,1.012621,1.03789,1.006659,0.984484,1.005593,0.982695,0.983807,0.999649,0.968237,0.881651,0.991403,0.933831,1.001764,1.097065,1.011695,1.010367,0.993375,0.989722,1.002577,1.01625,0.828168,1.105413
2017,1.049373,0.907035,1.018491,1.021273,1.025028,1.040577,1.060677,1.132498,1.093477,1.160123,1.088642,1.102389,1.344721,1.00723,0.94186,1.029301,1.011911,1.030968,1.014601,0.981621,1.0,0.998715,1.063959,1.0,1.0
2018,1.042394,0.976786,1.074059,1.0245,1.019702,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.0,1.002574,1.034828,1.0,1.0
2019,1.032351,0.979401,1.019085,1.017913,1.028321,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.0,1.002567,1.034809,1.0,1.0
2020,1.067957,1.167938,0.947032,1.012495,1.041111,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.0,1.003841,1.034974,1.0,1.0
2021,1.071132,1.587189,1.283298,1.047189,1.01234,1.08209,1.041336,1.041335,1.283277,1.283185,0.912943,1.164429,1.792117,1.011965,8.619252,1.079518,1.03007,1.047248,1.047927,1.001796,1.0,1.002551,1.034869,1.0,1.0
2022,1.012519,1.122753,1.126169,1.079668,1.04053,1.069673,1.011446,1.011444,1.126174,1.126257,1.065769,1.053916,0.614105,1.047964,0.152665,1.020194,1.030159,1.048769,1.047573,0.999851,1.0,1.002545,1.034942,1.0,1.0
2023,1.071685,0.866302,1.082346,1.041353,1.004613,1.047498,1.08617,1.08622,1.082383,1.082323,1.115812,1.180977,0.755346,1.086103,0.748857,1.079838,1.030193,1.050822,1.048715,1.000448,1.0,1.003807,1.034968,1.0,1.0
2024,1.048148,0.804922,1.043234,1.029525,1.026747,1.048019,1.042794,1.042768,1.043195,1.043207,1.04517,1.025545,1.3078,1.053819,1.257741,1.056041,1.030334,1.048426,1.051767,0.99776,1.0,1.002528,1.034951,1.0,1.0
2025,1.041816,1.332261,1.042489,1.027674,1.031019,1.041912,1.033534,1.0335,1.042495,1.042459,1.04848,1.020951,1.262058,1.050753,1.150139,1.049347,1.030635,1.046248,1.052213,1.002245,1.0,1.003783,1.034897,1.0,1.0
2026,1.040067,0.92138,1.041261,1.029301,1.032702,1.034974,1.04156,1.041597,1.041261,1.041273,1.104211,1.056798,1.03124,1.034979,1.092855,1.047499,1.030633,1.072236,1.0,0.999552,1.0,1.002513,1.034808,1.0,1.0
2027,1.036538,0.958592,0.994087,1.025417,1.029,1.035776,1.041189,1.041154,0.994107,0.994125,1.070594,0.993921,0.957494,1.031636,1.062345,1.043841,1.030788,1.0,1.0,1.0,1.0,1.002506,1.034863,1.0,1.0
2028,1.035494,0.970307,0.993447,1.023663,1.030774,1.034248,1.039941,1.039927,0.993419,0.993402,1.086673,0.992658,0.940374,1.034233,1.025967,1.042648,1.030942,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
2029,1.033595,0.980131,1.000166,1.022858,1.030924,1.033076,1.039067,1.039111,1.000186,1.000222,1.075786,0.991511,0.975699,1.033447,1.01468,1.040489,1.031131,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
2030,1.033898,0.989135,1.017738,1.022663,1.031094,1.032667,1.038678,1.03866,1.017736,1.017715,1.054557,1.01322,0.998445,1.033943,1.012472,1.04064,1.03133,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
2031,1.03494,0.995169,1.028526,1.022531,1.030984,1.032004,1.037806,1.0378,1.028513,1.028538,1.051646,1.028241,1.012539,1.036568,1.026608,1.041542,1.03151,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
2032,1.035457,0.999777,1.034817,1.022578,1.031257,1.031167,1.036369,1.036352,1.03482,1.034796,1.048854,1.036945,1.020192,1.036387,1.029998,1.041845,1.031644,,,,,,,,
2033,1.035087,1.0014,1.036083,1.022611,1.030977,1.030948,1.035302,1.035308,1.036065,1.03609,1.041747,1.040731,1.024714,1.035312,1.02726,1.041341,1.031857,,,,,,,,
2034,1.035075,1.003101,1.037118,1.022572,1.031017,1.030992,1.034961,1.034963,1.037148,1.037113,1.04445,1.041905,1.027937,1.033459,1.028351,1.041055,1.032059,,,,,,,,
2035,1.034658,1.005994,1.037998,1.022526,1.030974,1.031065,1.034724,1.034714,1.037993,1.038018,1.037198,1.042629,1.029854,1.031715,1.027569,1.040521,1.032203,,,,,,,,
2036,1.034438,1.005976,1.037274,1.022582,1.031058,1.031309,1.034389,1.034408,1.037258,1.037253,1.034837,1.041391,1.030058,1.033301,1.028547,1.040194,1.032293,,,,,,,,
Loading