Skip to content

Commit

Permalink
update news
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Nov 15, 2023
1 parent 1dc2a09 commit 3e67dd6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: parameters
Title: Processing of Model Parameters
Version: 0.21.3.1
Version: 0.21.3.2
Authors@R:
c(person(given = "Daniel",
family = "Lüdecke",
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# parameters 0.21.4

## Breaking changes

* The `exponentiate` argument of `model_parameters()` for
`marginaleffects::predictions()` now defaults to `FALSE`, in line with all
the other `model_parameters()` methods.

# parameters 0.21.3

## Changes
Expand Down
16 changes: 15 additions & 1 deletion tests/testthat/test-marginaleffects.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
skip_if_not_installed("marginaleffects", minimum_version = "0.9.0")
skip_if_not_installed("marginaleffects", minimum_version = "0.15.0")
skip_if_not_installed("rstanarm")

test_that("marginaleffects()", {
Expand Down Expand Up @@ -44,6 +44,7 @@ test_that("predictions()", {


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")
Expand Down Expand Up @@ -71,6 +72,7 @@ test_that("comparisons()", {


test_that("marginalmeans()", {
data(mtcars)
dat <- mtcars
dat$cyl <- factor(dat$cyl)
dat$gear <- factor(dat$gear)
Expand All @@ -81,6 +83,7 @@ test_that("marginalmeans()", {


test_that("hypotheses()", {
data(mtcars)
x <- lm(mpg ~ hp + wt, data = mtcars)
m <- marginaleffects::hypotheses(x, "hp = wt")
expect_identical(nrow(parameters(m)), 1L)
Expand All @@ -89,6 +92,7 @@ test_that("hypotheses()", {

test_that("multiple contrasts: Issue #779", {
skip_if(getRversion() < "4.0.0")
data(mtcars)
mod <- lm(mpg ~ as.factor(gear) * as.factor(cyl), data = mtcars)
cmp <- suppressWarnings(marginaleffects::comparisons(
mod,
Expand All @@ -100,3 +104,13 @@ test_that("multiple contrasts: Issue #779", {
expect_true("Comparison: gear" %in% colnames(cmp))
expect_true("Comparison: cyl" %in% colnames(cmp))
})


test_that("model_parameters defaults to FALSE: Issue #916", {
data(mtcars)
mod <- lm(mpg ~ wt, data = mtcars)
pred <- marginaleffects::predictions(mod, newdata = marginaleffects::datagrid(wt = c(1, 2)))
out1 <- model_parameters(pred)
out2 <- model_parameters(pred, exponentiate = FALSE)
expect_equal(out1$Predicted, out2$Predicted, tolerance = 1e-4)
})

0 comments on commit 3e67dd6

Please sign in to comment.