Fit Time Series Regression Models.
tslm(
x,
trend.order = 1,
seasonal = FALSE,
period = NA,
type = c("additive", "multiplicative"),
train.prop = 1
)# S3 method for tslm
print(x, digits = max(3L, getOption("digits") - 3L), ...)
# S3 method for tslm
summary(
object,
anova = TRUE,
digits = max(3L, getOption("digits") - 3L),
se = TRUE,
signif.stars = TRUE,
...
)
An object of class `tslm` is a list containing at least the following components:
a named vector of coefficients
the residuals, that is response minus fitted values
the numeric rank of the fitted linear model
the fitted mean values
the residual degrees of freedom
the matched call
the terms object used
(only where relevant) a record of the levels of the factors used in fitting
the offset used (missing if none were used)
if requested (the default), the model frame used
proportion of training data.
data of the original series.
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.
list of time in which the series values were used for model fitting. It will be the same as x.time if train.prop = 1.
data of the original series which were used for model fitting. It will be the same as x if train.prop = 1.
series name x in match 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 `tslm` object.
an integer specifying the polynomial order of the trend line estimation. If trend.order = 0, no trend component will be included in the model. Default is 1.
logical. If TRUE, seasonal component will be included in the model. Default is FALSE.
a numerical value specifying the seasonal cycle length of the series. If omitted, frequency(x) will be used here. Only effective if seasonal = TRUE. Default is NA.
string characters specifying the series type. Available options are `additive` and `multiplicative`. If `type = multiplicative`, interaction terms between trend and seasonal components will be added to the model. Default is `additive`.
a numerical value specifying the proportion of training data in the series. The value must be between 0 and 1. Default is 1.
the number of significant digits to use when printing
other printing or summary parameters.
a tslm object for summary
logical. If TRUE, an anova table with significance tests for trend, seasonality and their interaction will be included in the summary.
logical. If TRUE, standard error will be included in displaying the result. Default is TRUE.
logical. If TRUE, `significance stars` are printed for each coefficient
Ka Yui Karl Wu
Hyndman, R. J., Athanasopoulos, G. (2021). Forecasting: Principles and practice (3rd ed.). OTexts.
https://otexts.com/fpp3/
tslm(airport$Travellers, trend.order = 2,
seasonal = TRUE, type = "multiplicative")
Run the code above in your browser using DataLab