R: Random walk models

RW {fable} | R Documentation

## Random walk models

### Description

`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.

### Usage

    RW(formula, ...)

    NAIVE(formula, ...)

    SNAIVE(formula, ...)

### Arguments

`formula` | Model specification (see "Specials" section).
`...` | Not used.

### 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.

### Value

A model specification.

### 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)

`lag` | The 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)

`drift` | If `drift = TRUE`, a drift term will be included in the model.

### See Also

Forecasting: Principles and Practices, Some simple forecasting methods (section 3.2)

### Examples

    library(tsibbledata)
    aus_production %>%
      model(rw = RW(Beer ~ drift()))

    as_tsibble(Nile) %>%
      model(NAIVE(value))
    library(tsibbledata)
    aus_production %>%
      model(snaive = SNAIVE(Beer ~ lag("year")))

[Package fable version 0.3.0 Index]