Univariate metrics: edge cases in PIT, integer detection, interval coverage and input checks
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start by reading the affected metric implementations and their tests in the scoringutils package, especially pit_histogram_sample(), get_type(), interval_coverage(), logs_binary(), and the quantile and point metric functions. Reproduce the listed examples and check existing tests for input validation, missing values, and matrix outputs. Done means the reported edge cases have consistent, tested behavior across the affected metrics.
Written by the indexing model from the issue text.
Description
CLAUDE: - [ ] The randomised PIT uses one uniform draw per replicate for all forecasts (runif(1)); Czado et al. (2009) use an independent draw per forecast. With few replicates the histogram of a calibrated forecast looks miscalibrated.
P <- matrix(rep(0:9, 100), 100, byrow = TRUE); set.seed(1)
pit_histogram_sample(rep(5, 100), P, seq(0, 1, 0.01)[c(1, 51:61, 101)],
integers = "random", n_replicates = 1)
#> 0 0 0 100 0 0 0 0 0 0 0 0
-
get_type()uses a relative tolerance, so continuous samples around 1e8 are classified as integer andbias_sample()uses the integer formula (bias_sample(1e8 + 0.5, matrix(1e8 + runif(200), 1))is about 0.5 rather than about 0). Values above 2^31 warn ("NAs introduced by coercion to integer range"). Suggestion:all(x == round(x)). -
interval_coverage()returnslogical(0)for interval ranges that are not round numbers, e.g.interval_range = 100 / 3with levels 1/3 and 2/3, because one comparison is rounded and the other is not. -
NAinquantile_levelis accepted and handled differently by each metric (quantile_score()givesNA,bias_quantile()a value,wis()an error). -
logs_binary()loses precision:-log(1 - abs(observed - predicted))returnsInfforp = 1e-17where 39.1 is correct. -
na.rmis inconsistent:wis()defaults toFALSE,bias_quantile()toTRUE, other quantile metrics have no such argument; sample metrics differ in whetherNAerrors, givesNA, or is dropped. - Point metrics are unvalidated anonymous functions with the argument
actualinstead ofobserved; inputs recycle silently. -
pit_histogram_sample()barely validatesn_replicatesandquantiles. - The default sample metrics include
log_score, which warns for every integer-valued data set, includingexample_sample_discrete. - Binary metrics return a matrix when
predictedis an n x 1 matrix.
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 2/5 1-3 hours Newbie friendliness 75/100
hubverse-org/hubDevs#83 ·
-
data_bio2rarify - doc - dimensions wrongPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
leppott/BioMonTools#162 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 78/100
-
publications
Difficulty 1/5 Under an hour Newbie friendliness 85/100
epiforecasts/epiforecasts.github.io#161 ·
Maintainers usually reply within 1 day