File: test-model_parameters.mclogit.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 (42 lines) | stat: -rw-r--r-- 1,038 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
skip_if_not_installed("mclogit")
skip_if_not_installed("withr")
skip_if_not(packageVersion("insight") > "0.19.1")

skip_on_cran()

withr::with_options(
  list(parameters_exponentiate = FALSE),
  {
    data(Transport, package = "mclogit")
    invisible(capture.output({
      m1 <- mclogit::mclogit(
        cbind(resp, suburb) ~ distance + cost,
        data = Transport
      )
    }))

    data(housing, package = "MASS")
    invisible(capture.output({
      m2 <- mclogit::mblogit(Sat ~ Infl + Type + Cont,
        weights = Freq,
        data = housing
      )
    }))

    test_that("model_parameters.mclogit", {
      params <- model_parameters(m1)
      expect_snapshot(params)
    })
    test_that("model_parameters.mblogit", {
      params <- model_parameters(m2)
      expect_snapshot(params)
    })

    skip_on_os(c("mac", "linux"))
    test_that("simulate_parameters.mblogit", {
      set.seed(1234)
      params <- simulate_parameters(m2)
      expect_snapshot(params)
    })
  }
)