Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing *marginaleffects* test #1049

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions tests/testthat/test-marginaleffects.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
skip_if_not_installed("marginaleffects", minimum_version = "0.18.0")
skip_if_not_installed("insight", minimum_version = "0.19.9")
skip_if_not_installed("marginaleffects", minimum_version = "1.0.0")
skip_if_not_installed("rstanarm")

test_that("marginaleffects()", {
# Frequentist
x <- lm(Sepal.Width ~ Species * Petal.Length, data = iris)
model <- marginaleffects::avg_slopes(x, newdata = insight::get_datagrid(x, by = "Species"), variables = "Petal.Length")

Check warning on line 7 in tests/testthat/test-marginaleffects.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=tests/testthat/test-marginaleffects.R,line=7,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 121 characters.
out <- parameters(model)
expect_identical(nrow(out), 1L)
cols <- c("Parameter", "Comparison", "Coefficient", "SE", "Statistic", "p", "S", "CI", "CI_low", "CI_high")
Expand All @@ -23,7 +22,7 @@
chains = 1
)
)
model <- marginaleffects::avg_slopes(x, newdata = insight::get_datagrid(x, by = "Species"), variables = "Petal.Length")

Check warning on line 25 in tests/testthat/test-marginaleffects.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=tests/testthat/test-marginaleffects.R,line=25,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 121 characters.
expect_identical(nrow(parameters(model)), 1L)
})

Expand All @@ -46,7 +45,7 @@
data(iris)
# Frequentist
x <- lm(Sepal.Width ~ Species * Petal.Length, data = iris)
m <- marginaleffects::avg_comparisons(x, newdata = insight::get_datagrid(x, by = "Species"), variables = "Petal.Length")

Check warning on line 48 in tests/testthat/test-marginaleffects.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=tests/testthat/test-marginaleffects.R,line=48,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 122 characters.
expect_identical(nrow(parameters(m)), 1L)
out <- parameters(m, exponentiate = TRUE)
expect_equal(out$Coefficient, 1.393999, tolerance = 1e-4)
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test-serp.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
skip_if_not_installed("serp")
skip_if_not_installed("insight", minimum_version = "0.20.0")
skip_if_not_installed("withr")

# make sure we have the correct interaction mark for tests
Expand Down
Loading