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=pkg%2FR%2FJ_Neighbors.R;h=3c9bc30df25f21bd7b714f77c08d7f6ce4fea184;hb=2bc64a5b0d971770bca13f2c199e0f63bf5026d5;hp=03d334064a43f40d2d307e86e3f8b5c7e95cfafa;hpb=469529710f56c790ae932b45d13fed2e34bcabf2;p=talweg.git diff --git a/pkg/R/J_Neighbors.R b/pkg/R/J_Neighbors.R index 03d3340..3c9bc30 100644 --- a/pkg/R/J_Neighbors.R +++ b/pkg/R/J_Neighbors.R @@ -1,13 +1,15 @@ #' Obtain jump forecast by the Neighbors method #' -#' @inheritParams getForecast +#' @inheritParams computeForecast #' @inheritParams getZeroJumpPredict +#' getNeighborsJumpPredict = function(data, today, memory, horizon, params, ...) { first_day = max(1, today-memory) filter = params$indices >= first_day indices = params$indices[filter] weights = params$weights[filter] + if (any(is.na(weights) | is.na(indices))) return (NA)