Initial commit
[talweg.git] / R / S_Average.R
... / ...
CommitLineData
1#' @include ShapeForecaster.R
2#'
3#' @title Average Shape Forecaster
4#'
5#' @description Return the (pointwise) average of the all the centered day curves in the past.
6#' Inherits \code{\link{ShapeForecaster}}
7AverageShapeForecaster = setRefClass(
8 Class = "AverageShapeForecaster",
9 contains = "ShapeForecaster",
10
11 methods = list(
12 initialize = function(...)
13 {
14 callSuper(...)
15 },
16 predict = function(today, memory, horizon, ...)
17 {
18 avg = rep(0., horizon)
19 for (i in (today-memory):today)
20 {
21 if (!any(is.na(data$getSerie(i))))
22 avg = avg + data$getCenteredSerie(i)
23 }
24 avg
25 }
26 )
27)