swh:1:snp:2c68a6c5a8af2f06ac2c0225927f25b54fd1f9d0
Raw File
Tip revision: 3da49db3cf0eea4d2c5eba241ddb5470cd7dd929 authored by Dominique Makowski on 26 January 2021, 16:40:03 UTC
version 0.8.2
Tip revision: 3da49db
test-effective_sample.R
if (require("rstanarm") && require("brms") && require("insight")) {
  test_that("effective_sample", {
    brms_1 <- insight::download_model("brms_1")
    res <- effective_sample(brms_1)
    testthat::expect_equal(
      res,
      data.frame(
        Parameter = c("b_Intercept", "b_wt", "b_cyl"),
        ESS = c(5242, 2071, 1951),
        stringsAsFactors = F
      )
    )

    brms_null_1 <- insight::download_model("brms_null_1")
    res <- effective_sample(brms_null_1)
    testthat::expect_equal(
      res,
      data.frame(
        Parameter = c("b_Intercept"),
        ESS = c(2888),
        stringsAsFactors = F
      )
    )

    brms_null_2 <- insight::download_model("brms_null_2")
    res <- effective_sample(brms_null_2)
    testthat::expect_equal(
      res,
      data.frame(
        Parameter = c("b_Intercept"),
        ESS = c(1059),
        stringsAsFactors = F
      )
    )
  })
}
back to top