fix bugs
[talweg.git] / pkg / R / J_Zero.R
index d9140a5..01ba9e3 100644 (file)
@@ -1,10 +1,15 @@
-#' Just predict zero "jump" (for reference, benchmarking at least)
+#' getZeroJumpPredict
+#'
+#' "Reset level to 0": jump by -A where A is the last observed value.
 #'
 #' @inheritParams computeForecast
 #' @param today Index of the current day (predict tomorrow)
 #' @param params Optional parameters computed by the main forecaster
 #'
-getZeroJumpPredict = function(data, today, memory, horizon, params, ...)
+#' @aliases J_Zero
+#'
+getZeroJumpPredict = function(data, today, memory, predict_from, horizon, params, ...)
 {
-       0
+       list(...)$first_pred - ifelse( predict_from >= 2,
+               data$getSerie(today)[predict_from-1], tail(data$getSerie(today-1),1) )
 }