The function `predict` is generic and predicts past/future values of a time series.
# S3 method for tsarima
predict(
object,
n.ahead = 1L,
newxreg = NULL,
newxreg.est = c("none", "x", "auto.arima"),
se.fit = TRUE,
alpha = 0.05,
log = NULL,
...
)# S3 method for tsesm
predict(object, n.ahead = 1L, se.fit = TRUE, alpha = 0.05, ...)
# S3 method for tspredict
print(x, ...)
# S3 method for tslm
predict(object, n.ahead = 1L, se.fit = TRUE, alpha = 0.05, ...)
An object of class "tspredict".
The function print is used to obtain and print the prediction results, including the predicted values, the corresponding standard errors, as well as the lower and upper limit of the prediction intervals.
An object of class "tspredict" is a list usually containing the following elements:
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.
predicted past values and forecasted future values.
standard errors of the forecasted values.
lower and upper limits of the prediction interval.
number of forecasting periods.
logical. Indicates whether series values are log-transformed for model fitting or not. (Only available for class "tsarima")
significance level.
a time series or time series model for which prediction is required.
number of forecasting periods. Default is 1.
new values of the regressors. Only necessary if ARIMA model is built with independent variables.
character strings to indicate how the new values of the regressors in an ARIMAX model should be estimated in case they are not yet available. If newxreg is not NULL, this argument will be ignored. Available options are `none`, `x`, and `auto.arima`. The option `none` means that no estimation is needed, and the regressors will have no effect in future forecasts. The option `x` means that the regressors' value will forecasted based on the same model as `x`. The option `auto.arima` means that the regressors' value will forecasted based on the best model found by auto.arima(). Default is `none`.
logical. If TRUE, standard error of each prediction will be calculated and included. Default is TRUE.
significance level. (1 - alpha) indicates is the confidence level of the prediction interval. Default is 0.05.
optional. A logical value indicating whether the forecasted values are log-transformed and should be inverted back to the original series scale. If the object is an tsarima model and this parameter is omitted, the value will be taken over by the settings of the model given in object. Default is NULL here.
additional arguments affecting the forecasts produced.
a `tspredict` object.
Ka Yui Karl Wu
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/
predict(tsarima(airport$Travellers, order = c(1, 1, 0),
seasonal = c(0, 1, 1), log = TRUE, include.const = TRUE),
n.ahead = 6, alpha = 0.05)
predict(tsesm(airport$Travellers, order = "holt-winters"),
n.ahead = 6, alpha = 0.05)
Run the code above in your browser using DataLab