Skip to content

Commit bfc8f8f

Browse files
committed
posterior predictive check for binomial glm with matrix response
Fixes #644
1 parent 5dc4f80 commit bfc8f8f

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: performance
33
Title: Assessment of Regression Models Performance
4-
Version: 0.10.7.1
4+
Version: 0.10.7.2
55
Authors@R:
66
c(person(given = "Daniel",
77
family = "Lüdecke",

NEWS.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# performance 0.10.8
2+
3+
## Changes
4+
5+
* Changed behaviour of `check_predictions()` for models from binomial family,
6+
to get comparable plots for different ways of outcome specification. Now,
7+
if the outcome is a proportion, or defined as matrix of trials and successes,
8+
the produced plots are the same (because the models should be the same, too).
9+
10+
## Bug fixes
11+
12+
* Fixed CRAN check erros.
13+
114
# performance 0.10.7
215

316
## Breaking changes

R/check_predictions.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ pp_check.glm <- function(object,
263263
out <- tryCatch(
264264
{
265265
matrix_sim <- stats::simulate(object, nsim = iterations, re.form = re_formula, ...)
266-
as.data.frame(sapply(matrix_sim, function(i) i[, 1] / i[, 2], simplify = TRUE))
266+
as.data.frame(sapply(matrix_sim, function(i) i[, 1] / rowSums(i, na.rm = TRUE), simplify = TRUE))
267267
},
268268
error = function(e) {
269269
NULL
@@ -285,7 +285,7 @@ pp_check.glm <- function(object,
285285
)
286286
resp_string <- insight::find_terms(object)$response
287287

288-
out$y <- response[, 1] / response[, 2]
288+
out$y <- response[, 1] / rowSums(response, na.rm = TRUE)
289289

290290
# safe information about model
291291
if (!is.null(model_info)) {

0 commit comments

Comments
 (0)