inst/BookEx/C13R15.R

## Producing one-step ahead forecasts
Forecast <- function(x, order = c(1, 1, 1), ...){
  mod <- arima(x, order = order, ...)
  f1 <- forecast(mod, h = 1)$mean
  re <- (f1 - tail(x, 1)) * 100
  re
}
RetExp <- function(x, order = c(1, 1, 1), ...){
  ans <- apply(x, 2, Forecast, order = order, ...)
  ans
}
## Computing return forecasts
RE <- fapply(PELWeekly, from = spoints, to = epoints, FUN = RetExp)
head(RE)
tail(RE)

Try the FRAPO package in your browser

Any scripts or data that you put into this service are public.

FRAPO documentation built on May 2, 2019, 5:24 p.m.