cmu-delphi / cmu-delphi/epipredict

Make `adjust_latency` work or give nicer debug messages (on weekly data?)

Open
#474 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
R
Stars
18
Forks
13
Avg merge
21d 58m
Merged PRs (30d)
1

Description

I don't know what I'm doing wrong. There might be something funky going on with this data source right now (maybe just a tad out of date), but inspecting the edf, I don't see anything too egregious. Perhaps the latency adjustments are requesting shifts that don't actually exist in this weekly data set? But how is `"extend_lags"` getting lag 73, 80, and 87?

``` r
suppressPackageStartupMessages({
library(epidatr)
library(epiprocess)
library(epipredict)
library(dplyr)
})
cce <- covidcast_epidata()
as_of <- as.Date("2026-01-21")
nhsn_flu_tbl <- cce$signals$"nhsn:confirmed_admissions_flu_ew"$call("state", "*", "*", as_of = as_of)
nhsn_flu_edf <- nhsn_flu_tbl %>%
select(geo_value, time_value, value) %>%
as_epi_df(as_of = as_of)
max(nhsn_flu_tbl$issue)
#> [1] "2026-01-25"
range(nhsn_flu_edf$time_value)
#> [1] "2020-08-02" "2026-01-18"
nhsn_flu_edf %>%
arx_forecaster("value", args_list = arx_args_list(adjust_latency = "none"))
#> ══ A basic forecaster of type ARX Forecaster ═══════════════════════════════════
#>
#> This forecaster was fit on 2026-02-10 12:38:41.
#>
#> Training data was an with:
#> • Geography: state,
#> • Time type: week,
#> • Using data up-to-date as of: 2026-01-21.
#> • With the last data available on 2026-01-18
#>
#> ── Predictions ─────────────────────────────────────────────────────────────────
#>
#> A total of 54 predictions are available for
#> • 54 unique geographic regions,
#> • At forecast date: 2026-01-18,
#> • For target date: 2026-01-25,
#>
nhsn_flu_edf %>%
arx_forecaster("value", args_list = arx_args_list(adjust_latency = "extend_ahead"))
#> Error in `check_enough_data_core()` at epipredict/R/check_enough_data.R:95:3:
#> ! The following columns don't have enough data to train: lag_0_value,
#> lag_7_value, and lag_14_value.
nhsn_flu_edf %>%
arx_forecaster("value", args_list = arx_args_list(adjust_latency = "extend_lags"))
#> Error in `check_enough_data_core()` at epipredict/R/check_enough_data.R:95:3:
#> ! The following columns don't have enough data to train: lag_73_value,
#> lag_80_value, and lag_87_value.
```

Created on 2026-02-10 with [reprex v2.1.1](https://reprex.tidyverse.org)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.