File: test-parameters_type.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 (17 lines) | stat: -rw-r--r-- 695 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
test_that("parameters_type-1", {
  m0 <- lm(mpg ~ am * cyl, mtcars)
  m1 <- lm(mpg ~ am * scale(cyl), mtcars)
  m2 <- lm(mpg ~ scale(am) * cyl, mtcars)
  m3 <- lm(mpg ~ scale(am) * scale(cyl), mtcars)

  expect_equal(parameters_type(m0)[4, "Type"], "interaction")
  expect_equal(parameters_type(m1)[4, "Type"], "interaction")
  expect_equal(parameters_type(m2)[4, "Type"], "interaction")
  expect_equal(parameters_type(m3)[4, "Type"], "interaction")
})


test_that("parameters_type-2", {
  model <- lm(Sepal.Length ~ Petal.Width * scale(Petal.Length, TRUE, FALSE), data = iris)
  expect_equal(parameters_type(model)$Type, c("intercept", "numeric", "numeric", "interaction"))
})