Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Feb 11, 2024
1 parent f4c528b commit 4acf53e
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions tests/testthat/test-describe_posterior.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ test_that("describe_posterior", {
test = "all",
ci = c(0.8, 0.9)
))
expect_equal(dim(rez), c(2, 19))
expect_identical(dim(rez), c(2L, 19L))

rez <- describe_posterior(
x,
Expand All @@ -76,7 +76,7 @@ test_that("describe_posterior", {
))

rez <- suppressWarnings(describe_posterior(x, centrality = "all", dispersion = TRUE, test = "all"))
expect_equal(dim(rez), c(4L, 19L))
expect_identical(dim(rez), c(4L, 19L))
expect_warning(expect_warning(
describe_posterior(
x,
Expand All @@ -94,7 +94,7 @@ test_that("describe_posterior", {
test = "all",
ci = c(0.8, 0.9)
))
expect_equal(dim(rez), c(8L, 19L))
expect_identical(dim(rez), c(8L, 19L))

rez <- describe_posterior(
x,
Expand Down Expand Up @@ -163,7 +163,7 @@ test_that("describe_posterior", {
x <- suppressWarnings(brms::brm(mpg ~ wt + (1 | cyl) + (1 + wt | gear), data = mtcars, refresh = 0))
rez <- describe_posterior(x, centrality = "all", dispersion = TRUE, ci = c(0.8, 0.9))

expect_equal(dim(rez), c(4, 16))
expect_identical(dim(rez), c(4L, 16L))
expect_identical(colnames(rez), c(
"Parameter", "Median", "MAD", "Mean", "SD", "MAP", "CI", "CI_low",
"CI_high", "pd", "ROPE_CI", "ROPE_low", "ROPE_high", "ROPE_Percentage",
Expand All @@ -179,7 +179,7 @@ test_that("describe_posterior", {
diagnostic = NULL
)

expect_equal(dim(rez), c(2, 4))
expect_identical(dim(rez), c(2L, 4L))

model <- suppressWarnings(brms::brm(
mpg ~ drat,
Expand All @@ -189,7 +189,7 @@ test_that("describe_posterior", {
refresh = 0
))

expect_equal(nrow(describe_posterior(model)), 2)
expect_identical(nrow(describe_posterior(model)), 2L)

# rstanarm -------------------------------------------------

Expand Down Expand Up @@ -224,11 +224,11 @@ test_that("describe_posterior", {
# BayesFactor
x <- BayesFactor::ttestBF(x = rnorm(100, 1, 1))
rez <- describe_posterior(x, centrality = "all", dispersion = TRUE, test = "all")
expect_equal(dim(rez), c(1, 23))
expect_identical(dim(rez), c(1L, 23L))
rez <- describe_posterior(x, centrality = "all", dispersion = TRUE, test = "all", ci = c(0.8, 0.9))
expect_equal(dim(rez), c(2, 23))
expect_identical(dim(rez), c(2L, 23L))
rez <- describe_posterior(x, centrality = NULL, dispersion = TRUE, test = NULL, ci_method = "quantile")
expect_equal(dim(rez), c(1, 7))
expect_identical(dim(rez), c(1L, 7L))
})


Expand Down Expand Up @@ -580,6 +580,8 @@ test_that("describe_posterior: BayesFactor", {
ignore_attr = TRUE
))

skip_on_os("linux")

set.seed(123)
expect_equal(
describe_posterior(anovaBF(extra ~ group, data = sleep, progress = FALSE), ci_method = "hdi", ci = 0.95),
Expand Down

0 comments on commit 4acf53e

Please sign in to comment.