https://github.com/cran/bayestestR
Tip revision: 3da49db3cf0eea4d2c5eba241ddb5470cd7dd929 authored by Dominique Makowski on 26 January 2021, 16:40:03 UTC
version 0.8.2
version 0.8.2
Tip revision: 3da49db
test-p_significance.R
if (require("rstanarm", quietly = TRUE)) {
test_that("p_significance", {
set.seed(333)
x <- bayestestR::distribution_normal(10000, 1, 1)
ps <- bayestestR::p_significance(x)
testthat::expect_equal(as.numeric(ps), 0.816, tolerance = 0.1)
testthat::expect_equal(nrow(p_significance(data.frame(replicate(4, rnorm(100))))), 4)
testthat::expect_is(ps, "p_significance")
testthat::expect_equal(tail(capture.output(print(ps)), 1), "ps [0.10] = 81.60%")
})
.runThisTest <- Sys.getenv("RunAllbayestestRTests") == "yes"
if (.runThisTest) {
if (require("insight")) {
m <- insight::download_model("stanreg_merMod_5")
p <- insight::get_parameters(m, effects = "all")
testthat::expect_equal(
p_significance(m, effects = "all")$ps[1],
0.99,
tolerance = 1e-2
)
}
}
}