X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=pkg%2FR%2FJ_Persistence.R;h=37d05fe7968c845ae0362ab8553a838826c956c0;hb=102bcfda4afbb5cfee885cbee0f55545624168fd;hp=8ac597c3f17acc4ee3cfaa9003b646630e748be4;hpb=469529710f56c790ae932b45d13fed2e34bcabf2;p=talweg.git diff --git a/pkg/R/J_Persistence.R b/pkg/R/J_Persistence.R index 8ac597c..37d05fe 100644 --- a/pkg/R/J_Persistence.R +++ b/pkg/R/J_Persistence.R @@ -1,7 +1,15 @@ -#' Obtain jump forecast by the Persistence method +#' getPersistenceJumpPredict #' -#' @inheritParams getForecast +#' Analog of the PersistenceForecaster: predict the jump after last observed value either +#' by re-applying the last jump between similar day and its follower (if argument +#' "same_day" is TRUE), or by re-using the very last observed jump (when "same_day" = +#' FALSE). +#' +#' @inheritParams computeForecast #' @inheritParams getZeroJumpPredict +#' +#' @alias J_Persistence +#' getPersistenceJumpPredict = function(data, today, memory, horizon, params, ...) { #return gap between end of similar day curve and first day of tomorrow (in the past) @@ -12,7 +20,7 @@ getPersistenceJumpPredict = function(data, today, memory, horizon, params, ...) { { last_serie_end = tail( data$getSerie(index), 1) - last_tomorrow_begin = data$getSerie(index+1)[1] + last_tomorrow_begin = head( data$getSerie(index+1), 1) index = index - ifelse(same_day,7,1) }; if (!is.na(last_serie_end) && !is.na(last_tomorrow_begin))