Skip to content

hztopcu/fred-regression-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ FRED Regression Example

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

πŸ”§ Setup

  1. Python 3.10 or newer

  2. Install dependencies:

    pip install --upgrade pip
    pip install pandas pandas_datareader statsmodels matplotlib
  3. Configure your FRED API Key:

    • Windows CMD:

      set FRED_API_KEY=YOUR_KEY
    • PowerShell:

      $Env:FRED_API_KEY="YOUR_KEY"

▢️ Usage

Clone the repo and run:

python fred_regression_example.py

πŸ—‚οΈ Outputs

File Description
regression_summary.txt Detailed regression summary output
cpi_vs_fedfunds.png Scatter plot with regression line

πŸ“ˆ Quick Interpretation

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

πŸ“œ License

This project is licensed under the MIT License.

Open In Colab

About

FRED API regression example in Python

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors