R/ASE.R

Defines functions ase

Documented in ase

#' ASE calculator (specific to tswge)
#' Takes the last length(xhat) entries in x and compares them to xhat
#' @param x the time series
#' @param xhat the saved forecast (results of forecast function)
#' @return the ASE
#' @export
#' @examples
#' xs <- generate(arma, 200)
#' fore <- fcst(arma, xs, n.ahead =20, lastn = TRUE)
#' ase(xs, fore)

ase <- function(x, xhat){
  s <- length(x) - length(xhat$f) + 1
  n <- length(x)
  mean((xhat$f-x[s:n])^2)
}
josephsdavid/tswgewrapped documentation built on July 31, 2020, 9:36 a.m.