Skip to content
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
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.28.0.15
Version: 0.28.0.16
Authors@R:
c(person(given = "Daniel",
family = "Lüdecke",
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions R/utils_model_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#'
#' @keywords internal
#' @noRd
.add_model_parameters_attributes <- function(params,

Check warning on line 7 in R/utils_model_parameters.R

View workflow job for this annotation

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

file=R/utils_model_parameters.R,line=7,col=1,[cyclocomp_linter] Reduce the cyclomatic complexity of this expression from 41 to at most 40.
model,
ci,
exponentiate = FALSE,
Expand Down Expand Up @@ -254,7 +254,7 @@
#'
#' @keywords internal
#' @noRd
.find_coefficient_type <- function(info, exponentiate, model = NULL) {

Check warning on line 257 in R/utils_model_parameters.R

View workflow job for this annotation

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

file=R/utils_model_parameters.R,line=257,col=1,[cyclocomp_linter] Reduce the cyclomatic complexity of this expression from 57 to at most 40.
# column name for coefficients
coef_col <- "Coefficient"
if (!is.null(model) && inherits(model, "emmGrid")) {
Expand Down Expand Up @@ -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])
Expand Down
1 change: 1 addition & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ nestedLogit
nlme
nnet
nubmer
onwards
pam
pamk
patilindrajeets
Expand Down
12 changes: 6 additions & 6 deletions tests/testthat/_snaps/model_parameters_ordinal.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
26 changes: 13 additions & 13 deletions tests/testthat/test-marginaleffects.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-model_parameters_ordinal.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down Expand Up @@ -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
)

Expand Down
Loading