Skip to content

Commit

Permalink
fix and add test
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Jan 9, 2025
1 parent 51be1ab commit a88dd72
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/testthat/test-get_predicted.R
Original file line number Diff line number Diff line change
Expand Up @@ -651,9 +651,12 @@ test_that("brms: `type` in ellipsis used to produce the wrong intervals", {
)
x <- as.data.frame(get_predicted(model, ci = 0.95))
# Test shape
expect_identical(c(nrow(x), ncol(x)), c(96L, 1006L))
expect_identical(c(nrow(x), ncol(x)), c(96L, 1010L))
# Test whether median point-estimate indeed different from default (mean)
expect_gt(max(x$Predicted - get_predicted(model, centrality_function = stats::median)$Predicted), 0)
# predictions include variables from data grid
x <- get_predicted(model, ci = 0.95)
expect_named(x, c("Row", "Response", "cyl", "mpg", "vs", "carb", "Predicted"))
})


Expand Down

0 comments on commit a88dd72

Please sign in to comment.