Learn R Programming

fable (version 0.0.0.9000)

RW: 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(data, formula = ~lag(1))

NAIVE(data, formula = ~lag(1))

SNAIVE(data, formula = ~lag("smallest"))

Arguments

data

A data frame

formula

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.

Examples

Run this code
# NOT RUN {
library(tsibbledata)
elecdemand %>% RW(Demand ~ drift())


Nile %>% as_tsibble %>% NAIVE

library(tsibbledata)
elecdemand %>% SNAIVE(Temperature ~ lag("day"))

# }

Run the code above in your browser using DataLab