Initial commit
[talweg.git] / R / S_Persistence.R
CommitLineData
3d69ff21
BA
1#' @include ShapeForecaster.R
2#'
3#' @title Persistence Shape Forecaster
4#'
5#' @description Return the last centered last (similar) day curve (may be a lot of NAs,
6#' but we cannot do better). Inherits \code{\link{ShapeForecaster}}
7PersistenceShapeForecaster = setRefClass(
8 Class = "PersistenceShapeForecaster",
9 contains = "ShapeForecaster",
10
11 methods = list(
12 initialize = function(...)
13 {
14 callSuper(...)
15 },
16 predict = function(today, memory, horizon, ...)
17 {
18 #return centered last (similar) day curve (may be a lot of NAs, but we cannot do better)
19 last_similar_serie = data$getCenteredSerie(today-6)[1:horizon]
20 if (any(is.na(last_similar_serie))) #TODO:
21 return (NA)
22 last_similar_serie
23 }
24 )
25)