Skip to content

Instantly share code, notes, and snippets.

@Jeremiah-England
Last active March 10, 2024 16:05
Show Gist options
  • Save Jeremiah-England/dc1407d319ea0bf1b19f7d5d9853ed92 to your computer and use it in GitHub Desktop.
Save Jeremiah-England/dc1407d319ea0bf1b19f7d5d9853ed92 to your computer and use it in GitHub Desktop.
Child Tax Credit history plot in 2023 dollars
import io
from itertools import pairwise
import matplotlib.pyplot as plt
import pandas as pd
# https://www.minneapolisfed.org/about-us/monetary-policy/inflation-calculator/consumer-price-index-1913-
inflation_table_str = """
year CPI inflation_rate
1997 160.5 2.3%
1998 163.0 1.6%
1999 166.6 2.2%
2000 172.2 3.4%
2001 177.1 2.8%
2002 179.9 1.6%
2003 184.0 2.3%
2004 188.9 2.7%
2005 195.3 3.4%
2006 201.6 3.2%
2007 207.3 2.9%
2008 215.3 3.8%
2009 214.5 -0.4%
2010 218.1 1.6%
2011 224.9 3.2%
2012 229.6 2.1%
2013 233.0 1.5%
2014 236.7 1.6%
2015 237.0 0.1%
2016 240.0 1.3%
2017 245.1 2.1%
2018 251.1 2.4%
2019 255.7 1.8%
2020 258.8 1.2%
2021 271.0 4.7%
2022 292.7 8.0%
2023 304.7 4.1%
""".strip()
inflation_table = pd.read_csv(io.StringIO(inflation_table_str), delim_whitespace=True)
# Child Tax Credit
# https://www.ncsl.org/human-services/child-tax-credit-overview
ctc_by_year = {
# "Originally, the tax credit was $400 per child younger than age 17 and nonrefundable for most families. "
1997: 400,
# "In 1998, the tax credit was increased to $500 per child younger than age 17. "
1998: 500,
# "The tax credit amount increased again and was made refundable in 2001 to coordinate with the
# earned income tax credit. The refundable portion is called the additional child tax credit."
# Also: https://usafacts.org/articles/who-does-the-child-tax-credit-benefit-the-most/
# "The credit grew to $1,000 per child in 2001. It also became partially refundable,
# giving parents access to a portion of the credit left over after paying federal taxes."
# Also: https://www.cbpp.org/sites/default/files/archive/5-28-03tax3.htm#:~:text=First%2C%20it%20increased%20the%20size,a%20refund%20from%20the%20Treasury.
# "First, it increased the size of the credit from $500 per child to $600 in 2001 through 2004, $700 in 2005
# through 2008, $800 in 2009, and $1,000 in 2010. Second, it expanded the refundability of the credit — or the
# amount in excess of a household's tax liability that can be received as a refund from the Treasury."
2001: 600,
# The Jobs and Growth Tax Relief Reconciliation Act of 2003 raised the Child Tax Credit to a maximum
# of $1,000 per child from $600 per child, beginning in 2003.
2003: 1000,
# "The Tax Cuts and Jobs Act of 2017 doubled the tax credit to $2,000 and made limits
# to the refundable amount of up to $1,400 per child. "
2017: 2000,
# "The American Rescue Plan Act of 2021 temporarily expanded the child tax credit for the 2021 tax year to $3,600
# per child younger than age 6 and $3,000 per child up to age 17."
2021: 3000,
# "The federal child tax credit reverted to previous payment levels for the 2022 tax year."
2022: 2000,
2024: 2000, # Add the last year for plotting behavior below. 2023 + 1 due to the range function.
}
new_ctc_by_year = {}
for (start_year, value), (end_year, _) in pairwise(ctc_by_year.items()):
for year in range(start_year, end_year):
new_ctc_by_year[year] = value
print(new_ctc_by_year)
for year, value in new_ctc_by_year.items():
new_ctc_by_year[year] = value * (
inflation_table["CPI"].max() / inflation_table[inflation_table["year"] == year]["CPI"]
)
print(new_ctc_by_year)
# Plot the behavior of the child tax credit over time.
plt.title("Child Tax Credit Over Time -- 2023 Dollars")
plt.xlabel("Year")
plt.ylabel("Child Tax Credit ($)")
plt.plot(new_ctc_by_year.keys(), new_ctc_by_year.values(), marker="o")
# Not plot vertial lines and labesl for each Act
height = 600
plt.axvline(1997, color="r", linestyle="--")
plt.text(1997.2, height, "Taxpayer Relief Act (1997)", rotation=90)
plt.axvline(2001, color="r", linestyle="--")
plt.text(2001.2, height, "Economic Growth and Tax Relief Reconciliation Act of 2001", rotation=90)
plt.axvline(2003, color="r", linestyle="--")
plt.text(2003.2, height, "Jobs and Growth Tax Relief Reconciliation Act of 2003", rotation=90)
plt.axvline(2017, color="r", linestyle="--")
plt.text(2017.2, height, "Tax Cuts and Jobs Act of 2017", rotation=90)
plt.axvline(2021, color="r", linestyle="--")
plt.text(2021.2, height, "American Rescue Plan Act of 2021", rotation=90)
plt.axvline(2022, color="r", linestyle="--")
plt.text(2022.2, height, "Reversion to Previous Payment Levels", rotation=90)
# Set the y-axis to start at 0.
plt.ylim(0, 3500)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment