The `tsesm` function forecasts future values of a univariate time series using exponential smoothing.
tsesm(
x,
order = c("simple", "holt", "holt-winters"),
damped = FALSE,
initial = c("optimal", "simple"),
type = c("additive", "multiplicative"),
alpha = NULL,
beta = NULL,
gamma = NULL,
lambda = NULL,
phi = NULL,
biasadj = FALSE,
exp.trend = FALSE,
seasonal.period = NULL,
train.prop = 1
)# S3 method for tsesm
print(x, ...)
# S3 method for tsesm
summary(object, ...)
A list of class "tsesm" with components:
a vector of smoothing parameters.
number of seasons in the series, usually equivalent to the series' frequency obtained by tsfreq.
values used for fitting exponential smoothing model.
estimated values of all smoothing parameter for each observation.
initial values of the smoothing parameters.
residual variance.
the maximized log-likelihood, or the approximation to it used.
the AIC, AICc, and BIC values corresponding to the log-likelihood. Only valid for method = "ML" fits.
original series data or a `tsesm` object.
list of time in which the series values were observed.
time gap between the series and forecasted values.
name of the time series for which forecasts was requested.
a vector of fitted series values.
a vector of the series residuals.
logical value indicating whether damped trend was used or not.
method used for selecting initial state values.
indicator of an additive or multiplicative time series.
indicator of the use of exponential trend.
parameter value of the Box-Cox transformation.
indicator of the use of adjusted back-transformed mean for Box-Cox transformations.
series name x in match call.
the matched call.
a list of prediction error estimators, including $ME for mean error, $RMSE for root mean squared error, $MAE for mean absolute error, $MPE for mean percentage error, $MAPE for mean absolute percentage error, $MASE for mean absolute scaled error, $MASE.S for seasonal mean absolute scaled error, and $ACF1 for lag 1 autocorrelation.
a list of information regarding the prediction of the testing data including `x.test` (part of `x` used for testing), `fitted.test` (predicted values of the testing data), `residuals.test` (prediction error of the testing data), and `error.test` (prediction error measurements based on the testing data). Only available if train.prop is smaller than 1.
a univariate time series or a `tsesm` object.
a specification of the exponential smoothing method. The available options are "simple", "holt", "holt-winters".
logical. If TRUE, a damped trend is used. Default is FALSE.
method used for selecting initial state values. Available options are `optimal` and `simple`. If `optimal`, the initial values are optimised along with the smoothing parameters using `ets`. If `simple`, the initial values are set to values obtained using simple calculations on the first few observations.
specify whether the time series is `additive` or `multiplicative`.
value of smoothing parameter for the level. If NULL, it will be estimated.
value of smoothing parameter for the trend. If NULL, it will be estimated.
value of smoothing parameter for the seasonal component If NULL, it will be estimated.
parameter of the Box-Cox transformation. If lambda = "auto", a transformation is automatically selected using `BoxCox.lambda`. The transformation is ignored if NULL. Otherwise, data transformed before model is estimated.
value of damping parameter if damped = TRUE. If NULL, it will be estimated.
use adjusted back-transformed mean for Box-Cox transformations. If transformed data is used to produce forecasts and fitted values, a regular back transformation will result in median forecasts. If biasadj == TRUE, an adjustment will be made to produce mean forecasts and fitted values.
logical. If TRUE, an exponential trend is fitted. Otherwise, the trend is (locally) linear. Default is FALSE.
number of seasons within a seasonal cycle. If NULL, the value of frequency(x) will be taken. Default is NULL.
a numerical value specifying the proportion of training data in the series. The value must be between 0 and 1. Default is 1.
other printing parameters
a `tsesm` object to summarise.
Ka Yui Karl Wu
The `tsesm` function uses the same mechanism for exponential smoothing like `forecast::ses`, `forecast::holt`, and `forecast::hw`. Instead of using three different functions, all of them are integrated in tsesm, and user can choose the method by specifying the value of the order parameter.
The option `simple` is the lowest exponential smoothing order, or the first exponential smoothing order (that's why the parameter is called `order` and not `method`). It can be used to forecast series with only level \((\ell)\) component. The corresponding forecasting formula is given by:
$$\tilde{x}_{t+h|t} = \ell_t = \alpha x_{t-1} + (1-\alpha)\ell_{t-1},$$
where \(\alpha\) is the smoothing parameter for the level component, and \(h\) is the number of periods ahead for forecasting.
With the `holt` option, the second exponential smoothing order can be chosen. It is suitable for the forecasting of series with level \((\ell)\) and trend \((b)\) components.
$$\ell_t = \alpha x_{t} + (1-\alpha)(\ell_{t-1} + b_{t-1})$$
$$b_t = \beta(\ell_{t}-\ell_{t-1}) + (1-\beta)b_{t-1}$$
$$\tilde{x}_{t+h|t} = \ell_{t}+hb_{t}$$
where \(\alpha\) and \(\beta\) are the smoothing parameters for the level and trend components, respectively, \(h\) is the number of periods ahead for forecasting.
The third exponential smoothing order can be specified by the `holt-winters` option. It can be used to forecast time series with level \((\ell)\), trend \((b)\), and seasonal \((s)\) components.
$$\ell_t = \alpha (x_{t} - s_{t-m}) + (1-\alpha)(\ell_{t-1} + b_{t-1})$$
$$b_t = \beta(\ell_{t}-\ell_{t-1}) + (1-\beta)b_{t-1}$$
$$s_t = \gamma(x_{t}-\ell_{t-1}-b_{t-1}) + (1-\gamma)s_{t-m}$$
$$\tilde{x}_{t+h|t} = \ell_{t}+hb_{t}+s_{t+h-m(k+1)}$$
where \(\alpha\), \(\beta\), and \(\gamma\) are the smoothing parameters for the level, trend, and seasonal components, respectively, \(h\) is the number of periods ahead for forecasting, \(m\) is the number of periods within a seasonal cycle, and \(k\) is the integer part of \((h-1)/m\), which ensures that the estimates of the seasonal indices used for forecasting come from the final period of the series.
If train.prop is smaller than 1, the function will only treat the training part of the series as past data. When applying `tsforecast` or `predict`, the forecast will start after the end of the training part of the original series.
Box, G. E. P., & Jenkins, G. M. (1970). Time series analysis: Forecasting and control. Holden-Day.
Hyndman, R. J., Athanasopoulos, G. (2021). Forecasting: Principles and practice (3rd ed.). OTexts.
https://otexts.com/fpp3/
Hyndman, R. J., Athanasopoulos, G., Bergmeir, C., Caceres, G., Chhay, L., O'Hara-Wild, M., Petropoulos, F., Razbash, S., Wang, E., Yasmeen, F. (2025).
forecast: Forecasting functions for time series and linear models. R package version 8.24.0,
https://pkg.robjhyndman.com/forecast/.
Hyndman, R. J., Khandakar, Y. (2008). Automatic time series forecasting: the forecast package for R. Journal of Statistical Software, 27(3), 1-22.
tsesm(airport$Travellers, order = "simple")
tsesm(airport$Travellers, order = "holt")
tsesm(airport$Travellers, order = "holt-winters")
Run the code above in your browser using DataLab