Author: Mykola Chernyashevskyy
Affiliation: University of Pittsburgh, Department of Physics and Astronomy
Email: myc21@pitt.edu
This project explores long-term trends in U.S. national defense spending from 1962 to 2023, adjusted to constant FY 2017 dollars. The data reveals both cyclical and linear behaviorβcapturing both political cycles and long-term increases.
We fit the data using a combined sinusoidal + linear model and extract local maxima and minima to highlight key turning points in defense budgets. The plot also shades presidential administrations by party to provide historical context.
- Source: U.S. historical budget data for national defense outlays (in constant FY 2017 USD).
- Years Covered: 1962β2023
- Data Shape:
year: 62 time points (1962β2023)Spending: National defense spending (in billions)
The spending curve is modeled as:
[ y = A \cdot \sin(Bx + C) + Dx + E ]
Where:
A: amplitude of oscillationB: frequency of oscillationC: phase shiftD: slope of linear trendE: intercept
- Local Maxima: Identified using
scipy.signal.find_peaks - Local Minima: Detected by applying the same method to
-y
U.S. presidential administrations are shaded:
- π¦ Blue: Democratic
- π₯ Red: Republican
These intervals are marked using plt.fill_betweenx.
- β« Scatter plot of original spending data
- π’ Sinusoidal + linear best-fit curve
- β Annotated local peaks (green) and troughs (orange)
- π Fit equation displayed directly on the plot
- π₯π¦ Background shading for political context
Make sure you have the following Python libraries installed:
pip install numpy matplotlib scipy