Skip to content

Commit

Permalink
improve print for mblogit
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Sep 29, 2024
1 parent a7c872b commit 3cacdfd
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 1 deletion.
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.22.2.14
Version: 0.22.2.15
Authors@R:
c(person(given = "Daniel",
family = "Lüdecke",
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ S3method(simulate_model,zeroinfl)
S3method(simulate_parameters,default)
S3method(simulate_parameters,glmmTMB)
S3method(simulate_parameters,hurdle)
S3method(simulate_parameters,mblogit)
S3method(simulate_parameters,mlm)
S3method(simulate_parameters,multinom)
S3method(simulate_parameters,nestedLogit)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

* Updated *glmmTMB* methods to work with the latest version of the package.

* Improved printing for `simulate_parameters()` for models from packages *mclogit*.

# parameters 0.22.2

## New supported models
Expand Down
3 changes: 3 additions & 0 deletions R/methods_mclogit.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,6 @@ p_value.mblogit <- function(model, ...) {
row.names = NULL
)
}

#' @export
simulate_parameters.mblogit <- simulate_parameters.multinom
33 changes: 33 additions & 0 deletions tests/testthat/_snaps/model_parameters.mclogit.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,36 @@
Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
using a Wald z-distribution approximation.

# simulate_parameters.mblogit

Code
params
Output
# Medium response
Parameter | Coefficient | 95% CI | p
-----------------------------------------------------
(Intercept) | -0.42 | [-0.73, -0.09] | 0.020
InflMedium | 0.44 | [ 0.17, 0.71] | < .001
InflHigh | 0.66 | [ 0.31, 1.02] | < .001
TypeApartment | -0.43 | [-0.78, -0.11] | 0.012
TypeAtrium | 0.12 | [-0.28, 0.58] | 0.588
TypeTerrace | -0.66 | [-1.07, -0.27] | 0.002
ContHigh | 0.35 | [ 0.10, 0.60] | 0.002
# High response
Parameter | Coefficient | 95% CI | p
-----------------------------------------------------
(Intercept) | -0.13 | [-0.43, 0.18] | 0.390
InflMedium | 0.74 | [ 0.46, 0.99] | < .001
InflHigh | 1.61 | [ 1.31, 1.94] | < .001
TypeApartment | -0.74 | [-1.04, -0.42] | < .001
TypeAtrium | -0.41 | [-0.82, -0.01] | 0.048
TypeTerrace | -1.42 | [-1.83, -1.04] | < .001
ContHigh | 0.48 | [ 0.23, 0.72] | < .001
Message
Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
using a MCMC distribution approximation.

5 changes: 5 additions & 0 deletions tests/testthat/test-model_parameters.mclogit.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,10 @@ withr::with_options(
params <- model_parameters(m2)
expect_snapshot(params)
})
test_that("simulate_parameters.mblogit", {
set.seed(1234)
params <- simulate_parameters(m2)
expect_snapshot(params)
})
}
)

0 comments on commit 3cacdfd

Please sign in to comment.