File: test-printing-stan.R

package info (click to toggle)
r-cran-parameters 0.24.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,852 kB
  • sloc: sh: 16; makefile: 2
file content (62 lines) | stat: -rw-r--r-- 2,267 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
skip_if_not_installed("curl")
skip_if_offline()
skip_on_cran()
skip_if_not_installed("brms")
skip_if_not_installed("insight")
skip_if_not_installed("withr")

withr::with_options(
  list(parameters_exponentiate = FALSE),
  {
    test_that("print brms", {
      m1 <- insight::download_model("brms_1")
      mp1 <- model_parameters(m1, effects = "all", component = "all", centrality = "mean")
      expect_snapshot(mp1)

      m2 <- insight::download_model("brms_mixed_1")
      mp2 <- model_parameters(m2, effects = "all", component = "all", centrality = "mean")
      expect_snapshot(mp2)

      m3 <- insight::download_model("brms_mixed_2")
      mp3 <- model_parameters(m3, effects = "all", component = "all", centrality = "mean")
      expect_snapshot(mp3)

      m4 <- insight::download_model("brms_mixed_3")
      mp4 <- model_parameters(m4, effects = "all", component = "all", centrality = "mean")
      expect_snapshot(mp4)

      m5 <- insight::download_model("brms_mixed_4")
      mp5 <- model_parameters(m5, effects = "all", component = "all", centrality = "mean")
      expect_snapshot(mp5)

      m6 <- insight::download_model("brms_mixed_7")
      mp6 <- model_parameters(m6, effects = "all", component = "all", centrality = "mean")
      expect_snapshot(mp6)

      m7 <- insight::download_model("brms_zi_1")
      mp7 <- model_parameters(m7, effects = "all", component = "all", centrality = "mean", verbose = FALSE)
      expect_snapshot(mp7)

      m8 <- insight::download_model("brms_zi_3")
      mp8 <- model_parameters(m8, effects = "all", component = "all", centrality = "mean", verbose = FALSE)
      expect_snapshot(mp8)

      m9 <- insight::download_model("brms_ordinal_1")
      mp9 <- model_parameters(m9, effects = "all", component = "all", centrality = "mean")
      expect_snapshot(mp9)
    })

    test_that("print-information", {
      skip_if_offline()
      skip_if_not_installed("httr2")

      m <- insight::download_model("brms_1")
      out <- model_parameters(m)
      expect_snapshot(out)
      out <- model_parameters(m, ci_method = "HDI")
      expect_snapshot(out)
      m <- insight::download_model("stanreg_glm_1")
      out <- model_parameters(m)
    })
  }
)