https://github.com/cran/bayestestR
Revision 9985109256c08d654edb46adb9cb20c913fb1888 authored by Dominique Makowski on 29 May 2019, 14:10:02 UTC, committed by cran-robot on 29 May 2019, 14:10:02 UTC
1 parent fe07bfa
Raw File
Tip revision: 9985109256c08d654edb46adb9cb20c913fb1888 authored by Dominique Makowski on 29 May 2019, 14:10:02 UTC
version 0.2.0
Tip revision: 9985109
test-p_direction.R
context("p_direction")

test_that("p_direction", {
  set.seed(333)
  x <- bayestestR::distribution_normal(10000, 1, 1)
  pd <- bayestestR::p_direction(x)
  testthat::expect_equal(as.numeric(pd), 84.2, tolerance = 0.1)
  testthat::expect_equal(as.numeric(p_direction(x, method = "kernel")), 84.2, tolerance = 0.1)
  testthat::expect_equal(nrow(p_direction(data.frame(replicate(4, rnorm(100))))), 4)
  testthat::expect_is(pd, "p_direction")
  testthat::expect_equal(tail(capture.output(print(pd)), 1), "pd = 84.14%")
})
back to top