Skip to content

Commit

Permalink
fix test, revise tests
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Jul 14, 2024
1 parent 758e3c0 commit 9145e15
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
10 changes: 1 addition & 9 deletions tests/testthat/test-icc.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
skip_on_os("mac")
skip_on_cran()

test_that("icc", {
skip_on_cran()
m0 <- lm(Sepal.Length ~ Petal.Length, data = iris)
expect_warning(expect_null(icc(m0)))
})

test_that("icc", {
skip_on_cran()
skip_if_not_installed("lme4")
m1 <- lme4::lmer(Sepal.Length ~ Petal.Length + (1 | Species), data = iris)
expect_equal(
Expand All @@ -25,7 +24,6 @@ test_that("icc", {
# bootstrapped CIs ------------

test_that("icc, CI", {
skip_on_cran()
skip_if_not_installed("lme4")
data(sleepstudy, package = "lme4")
m <- lme4::lmer(Reaction ~ Days + (1 + Days | Subject), data = sleepstudy)
Expand All @@ -37,7 +35,6 @@ test_that("icc, CI", {


test_that("icc", {
skip_on_cran()
skip_if_not_installed("curl")
skip_if_offline()
skip_if_not_installed("httr2")
Expand All @@ -54,7 +51,6 @@ test_that("icc", {
})

test_that("icc", {
skip_on_cran()
skip_if_not_installed("curl")
skip_if_offline()
skip_if_not_installed("httr2")
Expand All @@ -68,7 +64,6 @@ test_that("icc", {
})

test_that("icc", {
skip_on_cran()
skip_if_not_installed("curl")
skip_if_offline()
skip_if_not_installed("httr2")
Expand All @@ -86,7 +81,6 @@ test_that("icc", {
})

test_that("icc", {
skip_on_cran()
skip_if_not_installed("lme4")
data(sleepstudy, package = "lme4")
set.seed(12345)
Expand Down Expand Up @@ -117,7 +111,6 @@ test_that("icc", {


test_that("icc", {
skip_on_cran()
skip_if_not_installed("nlme")
skip_if_not_installed("lme4")
m <- nlme::lme(Sepal.Length ~ Petal.Length, random = ~ 1 | Species, data = iris)
Expand All @@ -128,7 +121,6 @@ test_that("icc", {


test_that("icc, glmmTMB 1.1.9+", {
skip_on_cran()
skip_if_not_installed("glmmTMB", minimum_version = "1.1.9")
set.seed(101)
dd <- data.frame(
Expand Down
11 changes: 6 additions & 5 deletions tests/testthat/test-model_performance.bayesian.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
skip_on_cran()
skip_if_not_installed("rstanarm")
skip_if_not_installed("rstantools")

test_that("model_performance.stanreg", {
skip_on_cran()
skip_if_not_installed("curl")
skip_if_offline()
skip_if_not_installed("httr2")
Expand All @@ -24,14 +27,13 @@ test_that("model_performance.stanreg", {
skip_if(is.null(model))
perf <- model_performance(model)

expect_equal(perf$R2, 0.6286546, tolerance = 1e-3)
expect_equal(perf$R2_adjusted, 0.6053507, tolerance = 1e-3)
expect_equal(perf$R2, 0.642, tolerance = 1e-3)
expect_equal(perf$R2_adjusted, 0.6053454, tolerance = 1e-3)
expect_equal(perf$ELPD, -31.55849, tolerance = 1e-3)
})


test_that("model_performance.brmsfit", {
skip_on_cran()
skip_if_not_installed("curl")
skip_if_offline()
skip_if_not_installed("httr2")
Expand Down Expand Up @@ -72,7 +74,6 @@ test_that("model_performance.brmsfit", {


test_that("model_performance.BFBayesFactor", {
skip_on_cran()
skip_if_not_installed("BayesFactor")
mod <- BayesFactor::ttestBF(mtcars$wt, mu = 3)
expect_warning({
Expand Down
4 changes: 3 additions & 1 deletion tests/testthat/test-r2_bayes.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ test_that("r2_BayesFactor", {

test_that("r2_bayes", {
skip_on_cran()
skip_if_not_installed("curl")
skip_if_offline()
skip_if_not_installed("httr2")
skip_if_not_installed("rstanarm")
skip_if_not_installed("rstantools")
skip_if_not_installed("httr2")
model <- insight::download_model("stanreg_lmerMod_1")
set.seed(123)
out <- r2_bayes(model)
Expand Down

0 comments on commit 9145e15

Please sign in to comment.