diff --git a/DESCRIPTION b/DESCRIPTION index 13f6b4fd1..2363df65b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: parameters Title: Processing of Model Parameters -Version: 0.28.0.15 +Version: 0.28.0.16 Authors@R: c(person(given = "Daniel", family = "Lüdecke", diff --git a/NEWS.md b/NEWS.md index 8d7c933da..bdf705134 100644 --- a/NEWS.md +++ b/NEWS.md @@ -16,6 +16,9 @@ * Fixed issue with `equivalence_test()` for models of class `glmmTMB` with `beta_family()`. +* `exponentiate = TRUE` in `model_parameters()` did not exponentiate location + and scale parameters for models from package *ordinal*. + # parameters 0.28.0 ## Breaking Changes diff --git a/R/utils_model_parameters.R b/R/utils_model_parameters.R index 3c1151573..356305752 100644 --- a/R/utils_model_parameters.R +++ b/R/utils_model_parameters.R @@ -347,12 +347,9 @@ if (inherits(model, "mvord")) { rows <- params$Component != "correlation" } else if (is.null(params$Component)) { - # don't exponentiate dispersion rows <- seq_len(nrow(params)) - } else if (inherits(model, c("clm", "clm2", "clmm"))) { - ## TODO: make sure we catch all ordinal models properly here - rows <- !tolower(params$Component) %in% c("location", "scale") } else { + # don't exponentiate dispersion rows <- !tolower(params$Component) %in% c("dispersion", "residual") } params[rows, columns] <- exp(params[rows, columns]) diff --git a/inst/WORDLIST b/inst/WORDLIST index 40092a61f..f42bd3482 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -327,6 +327,7 @@ nestedLogit nlme nnet nubmer +onwards pam pamk patilindrajeets diff --git a/tests/testthat/_snaps/model_parameters_ordinal.md b/tests/testthat/_snaps/model_parameters_ordinal.md index 11f04370b..a0c285338 100644 --- a/tests/testthat/_snaps/model_parameters_ordinal.md +++ b/tests/testthat/_snaps/model_parameters_ordinal.md @@ -17,13 +17,13 @@ Parameter | Estimate | SE | 95% CI | z | p ------------------------------------------------------------ - Stim [Old] | 0.55 | 0.04 | [0.47, 0.63] | 13.64 | < .001 + Stim [Old] | 1.74 | 0.07 | [1.60, 1.88] | 13.64 | < .001 # Scale Parameters Parameter | Estimate | SE | 95% CI | z | p ------------------------------------------------------------ - Stim [Old] | -0.04 | 0.04 | [0.47, 0.63] | 13.64 | < .001 + Stim [Old] | 0.96 | 0.04 | [1.60, 1.88] | 13.64 | < .001 Message Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed @@ -48,13 +48,13 @@ Parameter | Estimate | SE | 95% CI | z | p ------------------------------------------------------------ - Stim [Old] | 0.55 | 0.04 | [0.47, 0.63] | 13.64 | < .001 + Stim [Old] | 1.74 | 0.07 | [1.60, 1.88] | 13.64 | < .001 # Scale Parameters - Parameter | Estimate | SE | 95% CI | z | p - ------------------------------------------------------------ - Stim [Old] | -0.04 | 0.04 | [-0.12, 0.04] | -1.11 | 0.268 + Parameter | Estimate | SE | 95% CI | z | p + ----------------------------------------------------------- + Stim [Old] | 0.96 | 0.04 | [0.89, 1.04] | -1.11 | 0.268 Message Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed diff --git a/tests/testthat/test-marginaleffects.R b/tests/testthat/test-marginaleffects.R index 05c4c526e..989a9e3fc 100644 --- a/tests/testthat/test-marginaleffects.R +++ b/tests/testthat/test-marginaleffects.R @@ -265,20 +265,20 @@ test_that("modelbased, tidiers work", { }) -## TODO: check this test locally - -# Following test may fail on CI, probably due to scoping issues? -# ── Error (test-marginaleffects.R:179:3): predictions, using bayestestR #1063 ─── -# Error in ``[.data.frame`(data, random_factors)`: undefined columns selected -# Backtrace: -# ▆ -# 1. ├─insight::get_datagrid(m, by = "Days", include_random = TRUE) at test-marginaleffects.R:179:3 -# 2. └─insight:::get_datagrid.default(m, by = "Days", include_random = TRUE) -# 3. ├─base::lapply(data[random_factors], as.factor) -# 4. ├─data[random_factors] -# 5. └─base::`[.data.frame`(data, random_factors) - test_that("predictions, using bayestestR #1063", { + # Following test may fail on CI, probably due to scoping issues? + # ── Error (test-marginaleffects.R:179:3): predictions, using bayestestR #1063 ─── + # Error in ``[.data.frame`(data, random_factors)`: undefined columns selected + # Backtrace: + # ▆ + # 1. ├─insight::get_datagrid(m, by = "Days", include_random = TRUE) at test-marginaleffects.R:179:3 + # 2. └─insight:::get_datagrid.default(m, by = "Days", include_random = TRUE) + # 3. ├─base::lapply(data[random_factors], as.factor) + # 4. ├─data[random_factors] + # 5. └─base::`[.data.frame`(data, random_factors) + ## TODO: check this test locally + skip("TODO: check this test locally, fails on CI, probably due to scoping issues?") + skip_on_ci() skip_on_cran() skip_if_not_installed("curl") diff --git a/tests/testthat/test-model_parameters_ordinal.R b/tests/testthat/test-model_parameters_ordinal.R index 834fe6e22..9f71f8138 100644 --- a/tests/testthat/test-model_parameters_ordinal.R +++ b/tests/testthat/test-model_parameters_ordinal.R @@ -53,7 +53,7 @@ test_that("model_parameters.clm", { mp <- model_parameters(m1, exponentiate = TRUE) expect_equal( mp$Coefficient, - c(0.48266, 0.85332, 1.30451, 2.006, 3.4376, 0.55237, -0.04069), + c(0.48266, 0.85332, 1.30451, 2.006, 3.4376, 1.737366, 0.9601267), tolerance = 1e-4 ) @@ -85,7 +85,7 @@ test_that("model_parameters.clm2", { mp <- model_parameters(m2, exponentiate = TRUE) expect_equal( mp$Coefficient, - c(0.48266, 0.85332, 1.30451, 2.006, 3.4376, 0.55237, -0.04069), + c(0.48266, 0.85332, 1.30451, 2.006, 3.4376, 1.73737, 0.96013), tolerance = 1e-4 )