1 #' Obtain delta forecast by the Neighbors method
3 #' @inheritParams getForecast
4 #' @inheritParams getZeroDeltaForecast
5 getNeighborsDeltaForecast = function(data, today, memory, horizon, shape_params, ...)
7 if (any(is.na(shape_params$weights) | is.na(shape_params$indices)))
10 gaps = sapply(shape_params$indices, function(i) {
11 data$getSerie(i+1)[1] - tail(data$getSerie(i), 1)
14 scal_product = shape_params$weights * gaps
15 norm_fact = sum( shape_params$weights[!is.na(scal_product)] )
16 sum(scal_product, na.rm=TRUE) / norm_fact