https://github.com/cran/scModels
Raw File
Tip revision: ba14d424c697de7a21f22f10407afbab9c5aaf7d authored by Lisa Amrhein on 24 January 2023, 07:20:02 UTC
version 1.0.4
Tip revision: ba14d42
test-discrete.R

test_that("Zero probabilities for non-integers", {
  expect_warning(expect_equal(dpb(1.5, 5, 3, 20), 0))
})

test_that("Zero probabilities for negative integers", {
  expect_equal(dpb(-1, 5, 3, 20), 0)
})

test_that("cdf vs cumsum(pdf)", {
  x <- seq(0, 500, by=1)
  epsilon <- 1e-4
  expect_equal(cumsum(dpb(x, 5, 3, 20)), ppb(x, 5, 3, 20), tolerance = epsilon)
})
back to top