File: test-ordered.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 (16 lines) | stat: -rw-r--r-- 647 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
test_that("ordered factors", {
  data(PlantGrowth)
  m_ord <- lm(weight ~ as.ordered(group), PlantGrowth)
  pt <- parameters_type(m_ord)
  mp <- model_parameters(m_ord)
  expect_identical(pt$Type, c("intercept", "ordered", "ordered"))
  expect_identical(pt$Parameter, c("(Intercept)", "as.ordered(group).L", "as.ordered(group).Q"))
  expect_identical(mp$Parameter, c("(Intercept)", "as.ordered(group).L", "as.ordered(group).Q"))
  expect_identical(
    attributes(mp)$pretty_names,
    c(
      `(Intercept)` = "(Intercept)", `as.ordered(group).L` = "group [linear]",
      `as.ordered(group).Q` = "group [quadratic]"
    )
  )
})