Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Jul 20, 2024
1 parent 0cf4066 commit 94cbce6
Show file tree
Hide file tree
Showing 4 changed files with 32 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.0.5
Version: 0.22.0.6
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 @@ -12,6 +12,9 @@
* `model_parameters()` for `anova()` from mixed models now also includes the
denominator degrees of freedom in the output (`df_error`).

* `print(..., pretty_names = "labels")` for tobit-models from package *AER* now
include value labels, if available.

* Patch release, to ensure that performance runs with older version of datawizard
on Mac OS X with R (old-release).

Expand Down
19 changes: 19 additions & 0 deletions tests/testthat/_snaps/print_AER_labels.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# templates

Code
print(mp, pretty_names = "labels")
Output
# Fixed Effects
Parameter | Coefficient | SE | 95% CI | z | p
-----------------------------------------------------------------------------------------------
(Intercept) | 8.72 | 3.45 | [ 1.95, 15.48] | 2.52 | 0.012
elder's dependency [slightly dependent] | -1.00 | 3.61 | [-8.08, 6.08] | -0.28 | 0.782
elder's dependency [moderately dependent] | 2.68 | 3.06 | [-3.32, 8.68] | 0.88 | 0.381
elder's dependency [severely dependent] | 3.88 | 3.00 | [-2.01, 9.77] | 1.29 | 0.197
carer's level of education | 1.14 | 0.90 | [-0.62, 2.90] | 1.27 | 0.204
Message
Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
using a Wald z-distribution approximation.

9 changes: 9 additions & 0 deletions tests/testthat/test-print_AER_labels.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
skip_if_not_installed("AER")
skip_if_not_installed("datawizard")

test_that("templates", {
data(efc, package = "datawizard")
model <- AER::tobit(neg_c_7 ~ e42dep + c172code, data = efc)
mp <- model_parameters(model)
expect_snapshot(print(mp, pretty_names = "labels"))
})

0 comments on commit 94cbce6

Please sign in to comment.