Simple exponential smoothing forecast for the next period

Forecasts the next period as a weighted average of the latest observation and the forecast that had been made for it, or equivalently the previous forecast corrected by a share alpha of its error. Unrolled, the weights on past observations decline exponentially with age. The method suits series with no clear trend or seasonal pattern; Holt's method adds a trend and seasonal versions add a seasonal component.

Signature

yhat_next = alpha * y_t + (1 - alpha) * yhat_t
Inputs
InputsDefinitionUnit
alphaWeight on the latest observation, from 0 to 1; values near 1 put most weight on recent observationsnone
y_tObserved use in period t, such as monthly emergency admissionsservices per period
yhat_tSmoothed level carried into period t, the previous forecastservices per period
Output
yhat_nextForecast for period t + 1, and for every later period, made at time tservices per period

Function

Forecasting health service use and measuring forecast accuracy

Maps past use and projected populations to forecasts of future service use, by applying age-specific use rates to a projected population or by smoothing a time series of activity, and compares forecasts with data held back from fitting to measure their accuracy. The notation follows the Demand Forecasting article and its ageing district.

Computational function

  • Computational function: simple exponential smoothing through a series with its sum of squared errors and next forecast

    Runs simple exponential smoothing through a whole series from a starting level, returning the one-step fitted values, their errors, the sum of squared errors (SSE) and the forecast for the next period. The inputs differ from the formula's: a series and a starting level instead of one observation and one forecast. Running it over a grid of alpha values and keeping the one with the lowest SSE reproduces the estimation the textbook describes.

    Inputs and outputs: y: Observed series in time order. Unit: services per period.; alpha: Smoothing parameter, from 0 to 1. Unit: none.; l0: Starting level, the forecast for the first period. Unit: services per period.; fitted: One-step forecasts for each period, in input order. Unit: services per period.; errors: Observed minus fitted. Unit: services per period.; SSE: Sum of squared errors. Unit: squared services.; next_forecast: Forecast for the period after the last observation. Unit: services per period.

    Assumption: No clear trend or seasonal pattern; the starting level is given or estimated with alpha.

    Worked example (Six months of emergency admissions, alpha 0.3): With admissions of 1,980, 2,040, 2,010, 2,100, 2,060 and 2,120 and a starting level of 2,000, the fitted values are 2,000, 1,994, 2,007.8, 2,008.46, 2,035.92 and 2,043.15, the SSE is about 17,386.79 and the next forecast about 2,066.20 (figures illustrative). y = [1980, 2040, 2010, 2100, 2060, 2120]; alpha = 0.3; l0 = 2000; SSE = 17386.79; next_forecast = 2066.2

    Worked example (Same series, alpha 0.5): A larger alpha follows the rising months more closely: SSE about 14,423.83, lower than at 0.3, and a next forecast of about 2,089.06 (computed here for illustration). alpha = 0.5; SSE = 14423.83; next_forecast = 2089.06

    Excel: With the series in Observed (rows 2 onwards of column B) and Alpha and InitLevel named, put =InitLevel in C2 and =Alpha*B2+(1-Alpha)*C2 in C3, filled down one row beyond the data; the last cell is the next forecast (NextValue) and =SUMXMY2(Observed,C2:C7) the SSE for six observations. Solver can minimise the SSE over Alpha and InitLevel.

    R: ses_run <- function(y, alpha, l0) { f <- Reduce(function(l, v) alpha*v+(1-alpha)*l, y, accumulate = TRUE, init = l0); n <- length(y); e <- y-f[1:n]; list(fitted = f[1:n], errors = e, SSE = sum(e^2), next_forecast = f[n+1]) } Base R only; ses_run(c(1980, 2040, 2010, 2100, 2060, 2120), 0.3, 2000) returns the first example, fitted values in input order.

    Python: def ses_run(y, alpha, l0): f = list(itertools.accumulate(y, lambda l, v: alpha*v+(1-alpha)*l, initial=l0)); e = [v-a for v, a in zip(y, f)]; return {"fitted": f[:-1], "errors": e, "SSE": sum(x*x for x in e), "next_forecast": f[-1]} Needs import itertools; returns the same values as the R function.

    Test (Recursion equals the weighted-average form): The next forecast equals the sum of Alpha times (1 minus Alpha) to the power j times the observation j periods back, plus (1 minus Alpha) to the power T times the starting level. Expected result: TRUE. FALSE shows the recursion started from the first observation instead of InitLevel. Excel check: =ABS(NextValue-(SUMPRODUCT(Observed,Alpha*(1-Alpha)^(ROWS(Observed)-SEQUENCE(ROWS(Observed))))+(1-Alpha)^ROWS(Observed)*InitLevel))<1E-6

    Common error (Choosing alpha by eye): The SSE at 0.5 is about 17 per cent below that at 0.3 for this series; alpha should be estimated on training data and the forecast checked on held-back data (HE-FM-DFC-003).

    Source: Hyndman RJ, Athanasopoulos G. Forecasting: Principles and Practice. 3rd ed. Melbourne: OTexts; 2021. Section 8.1 (weighted average form, flat forecasts, estimation by minimising the SSE).

    l_0 = l0; l_t = alpha * y_t + (1 - alpha) * l_(t-1); e_t = y_t - l_(t-1); SSE = sum_t e_t^2; yhat_next = l_T

Try this function

Implementations

  • Excel

    Simple exponential smoothing update from named cells

    With Alpha, LatestObs and PrevForecast named, the formula returns the next forecast, held in NextForecast.

    =Alpha*LatestObs+(1-Alpha)*PrevForecast

Assumptions

  • No clear trend or seasonal pattern in the smoothed series

    Simple smoothing gives a flat forecast, so it fits series that move around a slowly changing level; trend and seasonal patterns need Holt or seasonal methods.

  • Smoothing parameter and starting level estimated from training data

    alpha and the initial level are chosen by minimising the sum of squared one-step errors over the data used for fitting, then held fixed for the forecast.

Worked examples

  • Monthly emergency admissions with a smoothing parameter of 0.3

    If 2,100 admissions were observed against a forecast of 2,000, the next forecast is 0.3 times 2,100 plus 0.7 times 2,000, or 2,030 (figures illustrative).

    alpha = 0.3; y_t = 2100; yhat_t = 2000; yhat_next = 2030
  • Monthly emergency admissions with a smoothing parameter of 0.8

    With alpha of 0.8 the same month moves the forecast to 2,080, following the latest observation more closely (figures illustrative).

    alpha = 0.8; y_t = 2100; yhat_t = 2000; yhat_next = 2080
  • A month below forecast with a smoothing parameter of 0.3

    If only 1,900 admissions were observed against a forecast of 2,000, the next forecast falls to 1,970 (figures illustrative).

    alpha = 0.3; y_t = 1900; yhat_t = 2000; yhat_next = 1970

Common errors

  • Smoothing a series with a trend or seasonal pattern

    The forecast is flat, so a series that is rising, or that peaks every winter, is forecast too low in growth periods and in winter; Holt or seasonal methods are needed.

  • Extrapolating through a structural break

    Smoothing uses only the series' own past; in Stockholm, Linnér and colleagues found forecast accuracy was affected by the timing of new medicines and generics, the uptake of new medicines and sudden changes in reimbursement policy, which no extrapolation anticipates.

Sources

  • Simple exponential smoothing as a weighted average with alpha chosen by minimising SSE

    Hyndman RJ, Athanasopoulos G. Forecasting: Principles and Practice. 3rd ed. Melbourne: OTexts; 2021. Section 8.1, simple exponential smoothing: suitable for forecasting data with no clear trend or seasonal pattern; the forecast at T + 1 is a weighted average of the most recent observation and the previous forecast; if alpha is close to 1 more weight is given to recent observations; the smoothing parameter and initial level can be estimated by minimising the SSE.

    View source →

  • Accuracy of drug expenditure forecasts affected by launches, generics and policy

    Linnér L, Eriksson I, Persson M, Wettermark B. Forecasting drug utilization and expenditure: ten years of experience in Stockholm. BMC Health Services Research. 2020;20:410. doi:10.1186/s12913-020-05170-0 (abstract read). Abstract: accuracy was affected by the timing of the introduction of both new medicines and generics, the rate of uptake of new medicines and sudden changes in reimbursement policies; forecasts should be updated as close as possible prior to the decision date.

    View source →

Canonical Identity

Stable URI · Machine-readable · Resolvable · CC BY 4.0