random_walk_forc {lmForc}R Documentation

Random walk forecast

Description

random_walk_forc takes a vector of realized values, an integer number of periods ahead to forecast, and an optional vector of time data associated with the realized values. In each period, the current period value of the realized_vec series is set as the h_ahead period ahead forecast. Returns a random walk forecast where the h_ahead period ahead forecast is simply the present value of the series being forecasted.

Usage

random_walk_forc(realized_vec, h_ahead, time_vec = NULL)

Arguments

realized_vec

Vector of realized values. This is the series that is being forecasted.

h_ahead

Integer representing the number of periods ahead that is being forecasted.

time_vec

Vector of any class that is equal in length to the realized_vec vector.

Value

Forecast object that contains the random walk forecast.

See Also

For a detailed example see the help vignette: vignette("lmForc", package = "lmForc")

Examples

date <- as.Date(c("2010-03-31", "2010-06-30", "2010-09-30", "2010-12-31",
                  "2011-03-31", "2011-06-30", "2011-09-30", "2011-12-31", 
                  "2012-03-31", "2012-06-30"))
y  <- c(1.09, 1.71, 1.09, 2.46, 1.78, 1.35, 2.89, 2.11, 2.97, 0.99)
data <- data.frame(date, y)

random_walk_forc(
  realized_vec = data$y,
  h_ahead = 4L,
  time_vec = data$date 
)


[Package lmForc version 0.1.0 Index]