File: test-base.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 (23 lines) | stat: -rw-r--r-- 920 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
test_that("model_parameters.data.frame", {
  data(iris)
  expect_warning(expect_null(model_parameters(iris)))
})

test_that("model_parameters.data.frame as draws", {
  data(iris)
  mp <- suppressWarnings(model_parameters(iris[1:4], as_draws = TRUE))
  expect_equal(mp$Median, c(5.8, 3, 4.35, 1.3), tolerance = 1e-2, ignore_attr = TRUE)
  expect_identical(mp$Parameter, c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width"))
  expect_identical(colnames(mp), c("Parameter", "Median", "CI_low", "CI_high", "pd"))
})

test_that("model_parameters.data.frame as draws, exponentiate", {
  data(iris)
  mp <- suppressWarnings(model_parameters(iris[1:4], as_draws = TRUE, exponentiate = TRUE))
  expect_equal(mp$Median, c(330.29956, 20.08554, 77.47846, 3.6693), tolerance = 1e-2, ignore_attr = TRUE)
})

# require model input
test_that("model_parameters", {
  expect_error(model_parameters())
})