Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Added tolerance for numeric errors when checking that probabilities sum to one in ordinal forecasts (#997)
- Made computation of p-values optional in pairwise comparisons by allowing `test_type = NULL` in `compare_forecasts()`. When `test_type = NULL`, p-values will be `NA` (#978).
- Added a dependency on a scoringRules version >= 1.1.2 which is required for ordinal forecasts (#1006).
- A bug was fixed in PIT histograms from continuous values (#1010).

# scoringutils 2.1.0

Expand Down
3 changes: 1 addition & 2 deletions R/metrics-sample.R
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,6 @@ pit_histogram_sample <- function(observed,
p_x <- rowSums(predicted <= observed) / n_pred

# PIT calculation is different for integer and continuous predictions
predicted <- round(predicted)
if (get_type(predicted) == "integer" && integers != "ignore") {
p_xm1 <- rowSums(predicted <= (observed - 1)) / n_pred
if (integers == "random") {
Expand All @@ -572,7 +571,7 @@ pit_histogram_sample <- function(observed,
pit_values <- p_x
}

if (integers != "nonrandom") {
if (get_type(predicted) != "integer" || integers != "nonrandom") {
pit_histogram <- hist(pit_values, breaks = quantiles, plot = FALSE)$density
}

Expand Down