From d320b8709e39341a61698db30190d700e6ab02ae Mon Sep 17 00:00:00 2001 From: Vincent Arel-Bundock Date: Mon, 5 Feb 2024 07:43:47 -0500 Subject: [PATCH] marginaleffects_0_18_0 --- tests/testthat/test-marginaleffects.R | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/tests/testthat/test-marginaleffects.R b/tests/testthat/test-marginaleffects.R index 92305fdd6..2d1e7a300 100644 --- a/tests/testthat/test-marginaleffects.R +++ b/tests/testthat/test-marginaleffects.R @@ -4,12 +4,12 @@ skip_if_not_installed("rstanarm") test_that("marginaleffects()", { # Frequentist x <- lm(Sepal.Width ~ Species * Petal.Length, data = iris) - model <- marginaleffects::slopes(x, newdata = insight::get_datagrid(x, at = "Species"), variables = "Petal.Length") + model <- marginaleffects::avg_slopes(x, newdata = insight::get_datagrid(x, at = "Species"), variables = "Petal.Length") out <- parameters(model) expect_identical(nrow(out), 1L) expect_named(out, c( - "Parameter", "Comparison", "Coefficient", "SE", "Statistic", - "p", "CI", "CI_low", "CI_high" + "Parameter", "Coefficient", "SE", "Statistic", + "p", "s.value", "CI", "CI_low", "CI_high" )) out <- model_parameters(model, exponentiate = TRUE) expect_equal(out$Coefficient, 1.394, tolerance = 1e-3) @@ -24,7 +24,7 @@ test_that("marginaleffects()", { chains = 1 ) ) - model <- marginaleffects::slopes(x, newdata = insight::get_datagrid(x, at = "Species"), variables = "Petal.Length") + model <- marginaleffects::avg_slopes(x, newdata = insight::get_datagrid(x, at = "Species"), variables = "Petal.Length") expect_identical(nrow(parameters(model)), 1L) }) @@ -47,7 +47,7 @@ test_that("comparisons()", { data(iris) # Frequentist x <- lm(Sepal.Width ~ Species * Petal.Length, data = iris) - m <- marginaleffects::comparisons(x, newdata = insight::get_datagrid(x, at = "Species"), variables = "Petal.Length") + m <- marginaleffects::avg_comparisons(x, newdata = insight::get_datagrid(x, at = "Species"), variables = "Petal.Length") expect_identical(nrow(parameters(m)), 1L) out <- parameters(m, exponentiate = TRUE) expect_equal(out$Coefficient, 1.393999, tolerance = 1e-4) @@ -62,7 +62,7 @@ test_that("comparisons()", { chains = 1 ) ) - m <- marginaleffects::slopes( + m <- marginaleffects::avg_slopes( x, newdata = insight::get_datagrid(x, at = "Species"), variables = "Petal.Length" @@ -71,16 +71,6 @@ test_that("comparisons()", { }) -test_that("marginalmeans()", { - data(mtcars) - dat <- mtcars - dat$cyl <- factor(dat$cyl) - dat$gear <- factor(dat$gear) - x <- lm(mpg ~ cyl + gear, data = dat) - m <- marginaleffects::marginalmeans(x) - expect_identical(nrow(parameters(m)), 6L) -}) - test_that("hypotheses()", { data(mtcars)