A minimal Python script to:
- Fetch FEDFUNDS and CPIAUCSL data from the FRED API
- Perform a linear regression:
CPI ~ FEDFUNDS - Save results and visualize the trend line
-
Python 3.10 or newer
-
Install dependencies:
pip install --upgrade pip pip install pandas pandas_datareader statsmodels matplotlib
-
Configure your FRED API Key:
-
Windows CMD:
set FRED_API_KEY=YOUR_KEY
-
PowerShell:
$Env:FRED_API_KEY="YOUR_KEY"
-
Clone the repo and run:
python fred_regression_example.py| File | Description |
|---|---|
regression_summary.txt |
Detailed regression summary output |
cpi_vs_fedfunds.png |
Scatter plot with regression line |
Regression Results
- Dependent: CPI (Consumer Price Index)
- Independent: FEDFUNDS (Effective Federal Funds Rate)
- RΒ²: ~0.002 β explains only 0.2% of CPI variation
- Coefficient: ~-0.15 (p > 0.05) β not statistically significant
- Intercept: ~230 (p < 0.001)
- Conclusion: Limited direct linear impact; other macro factors likely drive CPI changes
This project is licensed under the MIT License.