`get_pit_histogram()` for quantile forecasts is wrong when forecasts have different quantile levels
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 72/100
Research direction
Start with get_pit_histogram.forecast_quantile() in R/class-forecast-quantile.R and trace how it builds bins and computes densities for each by group. Reproduce the example with models A and B, then check that groups with different quantile levels produce valid bins and densities. Done means B's histogram has four bins with densities 1, 1, 0, and 2, or the function aborts with a clear message when requested breaks are missing.
Written by the indexing model from the issue text.
Description
CLAUDE: The bins are built from the union of the quantile levels in the whole data set, but the densities are computed per by group from that group's own levels. A group with fewer quantile levels gets its densities recycled across the wrong bins. The only hint is a base R "longer object length" warning.
library(scoringutils); library(data.table)
ql <- c(0.1, 0.25, 0.5, 0.75, 0.9)
d <- data.table(model = "A", id = rep(1:4, each = 5), quantile_level = rep(ql, 4),
observed = rep(c(5, 1.5, 3, 10), each = 5), predicted = rep(1:5, 4))
d2 <- rbind(d, d[quantile_level %in% c(0.25, 0.5, 0.75)][, model := "B"])
get_pit_histogram(as_forecast_quantile(d2), by = "model")[model == "B"]
#> 6 bins with densities 2.5 1.67 0 2.0 1.67 2.5
#> correct for B: 4 bins [0,0.25) [0.25,0.5) [0.5,0.75) [0.75,1) with densities 1 1 0 2
Location: get_pit_histogram.forecast_quantile() in R/class-forecast-quantile.R. PR #1244 does not change this.
Suggested fix: require every group to contain all requested breaks (abort with a clear message otherwise), or compute the bins per group.
Found during a full review of the package (version 2.3.0.9000, main at 779d7d68).
- Dominant language
- R
- Stars
- 67
- Forks
- 24
- Avg merge
- 1h 24m
- Merged PRs (30d)
- 2
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from epiforecasts/scoringutils
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
epiforecasts/scoringutils#1264 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
epiforecasts/scoringutils#1265 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
epiforecasts/scoringutils#1260 ·
Maintainers usually reply within 1 day
-
Incorrect guidance in `NEWS.md` re `add_relative_skill()`?Possibly taken @nikosbosse claimed this 15 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
epiforecasts/scoringutils#1226 · 1 comment · 2 reactions ·
Maintainers usually reply within 1 day
-
get_pit_histogram(): unsorted breaks produce negative densities; num_bins = 1 returns an empty tablePossibly taken @nikosbosse claimed this 15 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
epiforecasts/scoringutils#1219 ·
Maintainers usually reply within 1 day
All issues in epiforecasts/scoringutils
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
leppott/BioMonTools#162 ·
-
publications
Difficulty 1/5 Under an hour Newbie friendliness 85/100
epiforecasts/epiforecasts.github.io#161 ·
Maintainers usually reply within 1 day
-
Label `{sas}` chunk source as `sas` instead of `txt`, so it gets syntax highlightingPossibly taken @michaelmayer2 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
microbiome/OMA#1031 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ThinkR-open/golem#1265 ·