RW() returns a random walk model, which is equivalent to an ARIMA(0,1,0) model with an optional drift coefficient included using drift(). naive() is simply a wrapper to rwf() for simplicity. snaive() returns forecasts and prediction intervals from an ARIMA(0,0,0)(0,1,0)m model where m is the seasonal period.

RW(formula, ...)

NAIVE(formula, ...)

SNAIVE(formula, ...)

Arguments

formula

Model specification (see "Specials" section).

...

Not used.

Value

A model specification.

Details

The random walk with drift model is $$Y_t=c + Y_{t-1} + Z_t$$ where \(Z_t\) is a normal iid error. Forecasts are given by $$Y_n(h)=ch+Y_n$$. If there is no drift (as in naive), the drift parameter c=0. Forecast standard errors allow for uncertainty in estimating the drift parameter (unlike the corresponding forecasts obtained by fitting an ARIMA model directly).

The seasonal naive model is $$Y_t= Y_{t-m} + Z_t$$ where \(Z_t\) is a normal iid error.

Specials

lag

The lag special is used to specify the lag order for the random walk process. If left out, this special will automatically be included.


lag(lag = NULL)
lagThe lag order for the random walk process. If lag = m, forecasts will return the observation from m time periods ago. This can also be provided as text indicating the duration of the lag window (for example, annual seasonal lags would be "1 year").

drift

The drift special can be used to include a drift/trend component into the model. By default, drift is not included unless drift() is included in the formula.


drift(drift = TRUE)
driftIf drift = TRUE, a drift term will be included in the model.

Examples

library(tsibbledata)
aus_production %>%
  model(rw = RW(Beer ~ drift()))
#> # A mable: 1 x 1
#>              rw
#>         <model>
#> 1 <RW w/ drift>

as_tsibble(Nile) %>%
  model(NAIVE(value))
#> # A mable: 1 x 1
#>   `NAIVE(value)`
#>          <model>
#> 1        <NAIVE>
library(tsibbledata)
aus_production %>%
  model(snaive = SNAIVE(Beer ~ lag("year")))
#> # A mable: 1 x 1
#>     snaive
#>    <model>
#> 1 <SNAIVE>