Fit a linear model with time series components

TSLM(formula, ...)

Arguments

formula

Model specification.

...

Additional arguments passed to lm

Specials

xreg

Exogenous regressors can be included in an ARIMA model without explicitly using the xreg() special. Common exogenous regressor specials as specified in common_xregs can also be used. These regressors are handled using stats::model.frame(), and so interactions and other functionality behaves similarly to stats::lm().
xreg(...)
...
Bare expressions for the exogenous regressors (such as
log(x))

Examples

USAccDeaths %>% as_tsibble %>% model(TSLM(log(value) ~ trend() + season()))
#> # A mable: 1 x 1 #> `TSLM(log(value) ~ trend() + season())` #> <model> #> 1 <TSLM>
library(tsibbledata) olympic_running %>% model(TSLM(Time ~ trend())) %>% interpolate(olympic_running)
#> # A tsibble: 312 x 4 [4Y] #> # Key: Length, Sex [14] #> Length Sex Year Time #> <fct> <chr> <dbl> <dbl> #> 1 100m men 1896 12 #> 2 100m men 1900 11 #> 3 100m men 1904 11 #> 4 100m men 1908 10.8 #> 5 100m men 1912 10.8 #> 6 100m men 1916 10.8 #> 7 100m men 1920 10.8 #> 8 100m men 1924 10.6 #> 9 100m men 1928 10.8 #> 10 100m men 1932 10.3 #> # … with 302 more rows