From 939fb8c2a6fb554802a8380f5a2d96be8b2e00f8 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 2 Jul 2023 14:59:57 +0200 Subject: [PATCH] styler --- R/bayesfactor_models.R | 6 +++--- tests/testthat/test-describe_posterior.R | 18 ++++++++++++------ tests/testthat/test-si.R | 9 ++++++--- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/R/bayesfactor_models.R b/R/bayesfactor_models.R index e5d919999..168cab5a3 100644 --- a/R/bayesfactor_models.R +++ b/R/bayesfactor_models.R @@ -217,9 +217,9 @@ bayesfactor_models.default <- function(..., denominator = 1, verbose = TRUE) { # Get BIC if (were_checked && estimator == "REML" && - any(vapply(mods, insight::is_mixed_model, TRUE)) && - !isTRUE(attr(objects, "same_fixef")) && - verbose) { + any(vapply(mods, insight::is_mixed_model, TRUE)) && + !isTRUE(attr(objects, "same_fixef")) && + verbose) { insight::format_warning( "Information criteria (like BIC) based on REML fits (i.e. `estimator=\"REML\"`)", "are not recommended for comparison between models with different fixed effects.", diff --git a/tests/testthat/test-describe_posterior.R b/tests/testthat/test-describe_posterior.R index 63ab514a7..a5d48ed20 100644 --- a/tests/testthat/test-describe_posterior.R +++ b/tests/testthat/test-describe_posterior.R @@ -108,9 +108,12 @@ test_that("describe_posterior", { set.seed(333) # Rstanarm x <- rstanarm::stan_glm(mpg ~ wt, data = mtcars, refresh = 0, iter = 500) - expect_warning({ - rez <- describe_posterior(x, centrality = "all", dispersion = TRUE, test = "all") - }, regex = "not be precise") + expect_warning( + { + rez <- describe_posterior(x, centrality = "all", dispersion = TRUE, test = "all") + }, + regex = "not be precise" + ) expect_identical(dim(rez), c(2L, 21L)) expect_identical(colnames(rez), c( "Parameter", "Median", "MAD", "Mean", "SD", "MAP", "CI", "CI_low", @@ -269,9 +272,12 @@ test_that("describe_posterior w/ BF+SI", { # test si set.seed(555) suppressMessages( - expect_warning({ - rez_si <- si(x) - }, regex = "not be precise") + expect_warning( + { + rez_si <- si(x) + }, + regex = "not be precise" + ) ) expect_equal(rez$CI_low, rez_si$CI_low, tolerance = 0.1) expect_equal(rez$CI_high, rez_si$CI_high, tolerance = 0.1) diff --git a/tests/testthat/test-si.R b/tests/testthat/test-si.R index e1a215292..f2d6b967e 100644 --- a/tests/testthat/test-si.R +++ b/tests/testthat/test-si.R @@ -5,9 +5,12 @@ test_that("si.numeric", { prior <- distribution_normal(1000, mean = 0, sd = 1) posterior <- distribution_normal(1000, mean = 0.5, sd = 0.3) - expect_warning({ - res <- si(posterior, prior) - }, regexp = "40") + expect_warning( + { + res <- si(posterior, prior) + }, + regexp = "40" + ) expect_equal(res$CI_low, 0.043, tolerance = 0.02) expect_equal(res$CI_high, 1.053103, tolerance = 0.02) expect_s3_class(res, "bayestestR_si")