Economics & Finance3 min read

Predicting Median Real Estate Prices in Select US Cities

Predicting Median Real Estate Prices in Select US Cities

Problem Statement

Home buyers, investors, and analysts need forward-looking price estimates to make informed decisions about when and where to buy. This Streamlit dashboard automates the process by building city-specific SARIMA models on monthly Redfin metro-level data, automatically selecting optimal parameters, and validating accuracy through walk-forward backtesting - giving users data-driven 12-month price forecasts for seven major metros.

Methodology

Preprocessing & Stationarity

Monthly median sale price series for each city were tested for stationarity using the Augmented Dickey-Fuller test. First-order differencing was applied to achieve stationarity, with ACF and PACF diagnostics confirming the transformation. Each city is modeled independently to capture its unique seasonal housing cycle.

Automatic Parameter Selection

Rather than manually tuning SARIMA parameters, the pipeline uses pmdarima’s auto_arima to search over (p, d, q) and (P, D, Q, 12) parameter spaces for each city, selecting the model that minimizes AIC. This ensures each city gets an individually optimized model without manual intervention.

Walk-Forward Backtesting

Models are validated using expanding-window walk-forward backtesting: train on 60+ months of historical data, forecast the next 12 months, step forward 6 months, and repeat. This simulates real-world conditions where the model only has access to past data, providing honest out-of-sample accuracy metrics.

Results

Multi-City Price Trends

Historical median sale price trends across major U.S. cities
Median sale price trends across seven major U.S. metros show diverging trajectories since 2020, with coastal markets like San Francisco experiencing post-pandemic corrections while Sun Belt cities hold elevated levels.

Year-over-Year Price Changes

Year-over-year price change heatmap by city
Year-over-year price changes reveal cyclicality and regional variation in housing appreciation, with the 2021–2022 boom visible across all markets followed by sharp deceleration.

City-Level SARIMA Forecasts

SARIMA forecast grid for all major cities with confidence intervals
12-month SARIMA forecasts with 95% confidence intervals for all seven cities plus the composite average. Forecast lines extend from the last observed data point, with shaded bands reflecting prediction uncertainty.

ROI Analysis

Projected 12-month ROI by city based on SARIMA forecasts
Projected 12-month return on investment by city, calculated as the percentage change from the last observed price to the forecast endpoint. Cities with positive ROI suggest expected price appreciation.

Model Validation

Walk-forward backtest MAPE by city
Walk-forward backtest Mean Absolute Percentage Error (MAPE) by city. Lower values indicate more accurate historical forecasts across multiple out-of-sample test windows.
Walk-forward backtest fold overlay showing actual vs predicted prices
Walk-forward backtest folds overlaid on actual prices. Each dashed line represents a 12-month out-of-sample forecast from a different training window, showing how predictions track reality across time.

Model Parameters

SARIMA model parameters and forecast summary table
Auto-selected SARIMA parameters for each city, along with average confidence interval width and forecast endpoint prices.

Price Distribution

Median sale price distribution by city
Price distributions across the full historical period highlight the wide spread between affordable markets like Chicago and premium markets like San Francisco.

Future Directions

  • Incorporate macro-economic features (mortgage rates, housing starts, CPI) as exogenous regressors via SARIMAX
  • Extend coverage to additional metro areas and smaller cities
  • Add ensemble methods combining SARIMA with machine learning models for improved accuracy

Tools and technologies

  • Python
  • Streamlit
  • statsmodels
  • SARIMA

Data source: RedfinStatus: Active

  • Time Series
  • SARIMA
  • Streamlit
  • Real Estate