https://github.com/cran/bayestestR
Tip revision: d2eac42f58e4e0f0d07298e8c2e719ef6a30672d authored by Dominique Makowski on 19 June 2020, 08:00:07 UTC
version 0.7.0
version 0.7.0
Tip revision: d2eac42
test-rstanarm.R
.runThisTest <- Sys.getenv("RunAllinsightTests") == "yes"
if (.runThisTest || Sys.getenv("USER") == "travis") {
if (requireNamespace("rstanarm", quietly = TRUE)) {
test_that("rstanarm", {
testthat::skip_on_cran()
set.seed(333)
library(rstanarm)
model <- insight::download_model("stanreg_lm_1")
testthat::expect_equal(rope_range(model)[1], -0.602, tol = 0.1)
model <- insight::download_model("stanreg_meanfield_lm_1")
testthat::expect_equal(rope_range(model)[1], -0.602, tol = 0.1)
model <- insight::download_model("stanreg_fullrank_lm_1")
testthat::expect_equal(rope_range(model)[1], -0.602, tol = 0.1)
model <- insight::download_model("stanreg_lmerMod_1")
testthat::expect_equal(rope_range(model)[1], -0.097, tol = 0.1)
model <- insight::download_model("stanreg_glm_1")
testthat::expect_equal(rope_range(model)[1], -0.18, tol = 0.1)
model <- insight::download_model("stanreg_merMod_1")
testthat::expect_equal(rope_range(model)[1], -0.18, tol = 0.1)
model <- insight::download_model("stanreg_gamm4_1")
testthat::expect_equal(rope_range(model)[1], -0.043, tol = 0.1)
model <- insight::download_model("stanreg_gam_1")
params <- describe_posterior(model, centrality = "all", test = "all", dispersion = TRUE)
testthat::expect_equal(c(nrow(params), ncol(params)), c(4, 22))
testthat::expect_is(hdi(model), "data.frame")
testthat::expect_is(ci(model), "data.frame")
testthat::expect_is(rope(model), "data.frame")
# testthat::expect_true("equivalence_test" %in% class(equivalence_test(model)))
testthat::expect_is(map_estimate(model), "data.frame")
testthat::expect_is(p_map(model), "data.frame")
testthat::expect_is(mhdior(model), "data.frame")
testthat::expect_is(p_direction(model), "data.frame")
# testthat::expect_error(equivalence_test(model, range = c(.1, .3, .5)))
# print(equivalence_test(model, ci = c(.1, .3, .5)))
})
}
}