Skip to content

1260: Retain integer observations above all samples in pit_histogram_sample() - #1283

Open
chenyangsu wants to merge 1 commit into
epiforecasts:mainfrom
chenyangsu:fix/pit-histogram-above-samples
Open

chenyangsu wants to merge 1 commit into
epiforecasts:mainfrom
chenyangsu:fix/pit-histogram-above-samples

Conversation

@chenyangsu

Copy link
Copy Markdown

Description

Fixes #1260.

With integers = "nonrandom", pit_histogram_sample(rep(20, 4), matrix(rep(1:10, 4), 4, byrow = TRUE), seq(0, 1, 0.25)) returns 0 0 0 0 because p_xm1 == p_x == 1 hits u <= p_xm1 at u = 1 before u >= p_x. Checking u >= p_x & u > 0 before u <= p_xm1 returns 0 0 0 4 while keeping F(0) = 0 so observations below all samples remain in the first bin (4 0 0 0), matching Czado et al. (2009) and integers = "random". Happy to add a NEWS.md bullet if you prefer.

Testing: devtools::test(filter = "metrics-sample|class-forecast-sample") (85 passed, 0 failed; 3 failed on base) and lintr::lint() on both changed files (0 lints).

Checklist

  • My PR is based on a package issue and I have explicitly linked it.
  • I have included the target issue or issues in the PR title as follows: issue-number: PR title
  • I have tested my changes locally.
  • I have added or updated unit tests where necessary.
  • I have updated the documentation if required.
  • I have built the package locally and run rebuilt docs using roxygen2.
  • My code follows the established coding standards and I have run lintr::lint_package() to check for style issues introduced by my changes.
  • I have added a news item linked to this PR.
  • I have reviewed CI checks for this PR and addressed them as far as I am able.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Non-randomised PIT for integer forecasts drops forecasts whose observation exceeds all samples

1 participant