X-Git-Url: https://git.auder.net/images/pieces/%22%20%20%20VariantRules.getPpath%28board%5Bi%5D%5Bj%5D%29%20%20%20%22.svg?a=blobdiff_plain;f=R%2FF_Persistence.R;h=fa5f99f5373b735b63f4618768f0b6eebab9694f;hb=HEAD;hp=f0784840ec6ac74d6db81713cad32cff02d626ae;hpb=e030a6e31232332b73187eda25870e843152c174;p=talweg.git diff --git a/R/F_Persistence.R b/R/F_Persistence.R deleted file mode 100644 index f078484..0000000 --- a/R/F_Persistence.R +++ /dev/null @@ -1,34 +0,0 @@ -#' @include Forecaster.R -#' -#' @title Persistence Forecaster -#' -#' @description Return the last centered last (similar) day curve. -#' Inherits \code{\link{Forecaster}} -PersistenceForecaster = setRefClass( - Class = "PersistenceForecaster", - contains = "Forecaster", - - methods = list( - initialize = function(...) - { - callSuper(...) - }, - predictShape = function(today, memory, horizon, ...) - { - #return centered last (similar) day curve, avoiding NAs until memory is run - first_day = max(1, today-memory) - index = today-7 + 1 - repeat - { - { - last_similar_serie = data$getCenteredSerie(index)[1:horizon] - index = index - 7 - }; - if (!any(is.na(last_similar_serie))) - return (last_similar_serie); - if (index < first_day) - return (NA) - } - } - ) -)