Skip to content

Commit

Permalink
fix the damn bins!
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasjclark committed Jun 21, 2023
1 parent 43c56a3 commit cc6fde7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions R/ppc.mvgam.R
Original file line number Diff line number Diff line change
Expand Up @@ -564,12 +564,14 @@ ppc.mvgam = function(object, newdata, data_test, series = 1, type = 'hist',
}

breaks <- seq(xlim[1], xlim[2], length.out = n_bins)
breaks <- sort(c(min(c(truths, as.vector(preds))),
breaks,
max(c(truths, as.vector(preds)))))
truths <- truths[truths<=xlim[2]]
truths <- truths[truths>=xlim[1]]
preds <- preds[preds<=xlim[2]]
preds <- preds[preds>=xlim[1]]

ylim <- c(0, max(c(max(hist(truths, breaks = breaks, plot = F)$density, na.rm = TRUE),
max(hist(preds, breaks = breaks, plot = F)$density, na.rm = TRUE))))
max(hist(preds, breaks = breaks, plot = F)$density, na.rm = TRUE)),
na.rm = TRUE))

if(missing(xlab)){
xlab <- paste0('Count')
Expand Down

0 comments on commit cc6fde7

Please sign in to comment.