# Time Series Forecasting

> Projecting metrics like sales and demand with trend, seasonality, baselines, exponential smoothing and honest error measures. Free notes, key concepts,...

Canonical: https://www.internhack.in/roadmaps/tracks/data-analyst/forecasting
Last updated: 2026-11-28

Projecting metrics like sales and demand with trend, seasonality, baselines, exponential smoothing and honest error measures.

Advanced · about 8 hours · difficulty 4/5

Learn first: [Linear and Logistic Regression for Analysts](https://www.internhack.in/roadmaps/tracks/data-analyst/regression-basics), [pandas for Data Analysis](https://www.internhack.in/roadmaps/tracks/data-analyst/pandas-core)

Planning teams constantly ask analysts "what will next quarter look like?" Forecasting gives a structured, testable answer instead of a guess.

### Understand the series first

- **Trend**: long-run increase or decrease.
- **Seasonality**: repeating patterns by week, month or year.
- **Holidays and events**: one-off spikes like sales events.
- **Noise**: what is left.

Plot the series and a **decomposition** before modelling anything.

### Start with baselines

- **Naive**: next value equals the last value.
- **Seasonal naive**: next Monday equals last Monday.
- **Moving average**.

A fancy model that cannot beat these is not worth using.

### Common methods

- **Exponential smoothing (ETS / Holt-Winters)**: weights recent observations more, handles trend and seasonality. Built into Excel as `FORECAST.ETS`.
- **ARIMA / SARIMA**: models autocorrelation; available in statsmodels.
- **Prophet**: handles multiple seasonalities and holidays with little tuning.
- **Regression with features**: price, promotions and marketing spend as drivers.

### Evaluate honestly

- Split by time: train on the past, test on the most recent period. Never shuffle.
- Measure error with **MAE**, **RMSE** or **MAPE** (careful with values near zero).
- Show **prediction intervals**, not just a single line.

**Pitfall:** presenting a single-line forecast with false precision. Communicate a range and the assumptions. You are ready to move on when you can forecast 12 weeks of a real series, beat a seasonal naive baseline on a holdout period, and chart the prediction interval.

## Key concepts

- **Trend, seasonality and decomposition**
- **Naive and seasonal naive baselines**
- **Exponential smoothing**
- **ARIMA and SARIMA**
- **Prophet**
- **Time-based train/test splits**
- **MAE, RMSE and MAPE**
- **Prediction intervals**

## Mini project

Forecast the next 12 weeks of a Kaggle store sales series using seasonal naive, Holt-Winters and one other method, and compare their MAE on the last 12 known weeks.

## Check yourself

Why must a forecasting test set be the most recent period rather than a random sample?

## Free resources

- [Forecasting: Principles and Practice (free online)](https://otexts.com/fpp3/) (Hyndman and Athanasopoulos)
- [statsmodels documentation](https://www.statsmodels.org/stable/index.html) (statsmodels)
- [Kaggle Learn: Time Series](https://www.kaggle.com/learn/time-series) (Kaggle)

Previous: [Data Quality Testing and Observability](https://www.internhack.in/roadmaps/tracks/data-analyst/data-quality-testing) · Next: [Customer Segmentation and Clustering](https://www.internhack.in/roadmaps/tracks/data-analyst/clustering-segmentation)

## More in Machine Learning for Analysts

- [Time Series Forecasting](https://www.internhack.in/roadmaps/tracks/data-analyst/forecasting)
- [Customer Segmentation and Clustering](https://www.internhack.in/roadmaps/tracks/data-analyst/clustering-segmentation)
- [Predictive Modelling with scikit-learn](https://www.internhack.in/roadmaps/tracks/data-analyst/predictive-modelling)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Data Analyst Roadmap](https://www.internhack.in/roadmaps/tracks/data-analyst)
