https://github.com/cran/bayestestR
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-estimate_density.R
context("estimate_density")

test_that("estimate_density", {
  library(logspline)
  library(KernSmooth)

  set.seed(333)
  x <- distribution_normal(500, 1)

  #' Methods
  density_kernel <- estimate_density(x, method = "kernel")
  density_logspline <- estimate_density(x, method = "logspline")
  density_KernSmooth <- estimate_density(x, method = "KernSmooth")

  testthat::expect_equal(mean(density_kernel$y - density_logspline$y), 0, tol = 0.1)
  testthat::expect_equal(mean(density_kernel$y - density_KernSmooth$y), 0, tol = 0.1)
})
back to top