tests/testthat/test-oibeta2.R

# Tests for the one-inflated beta distribution (mu/phi parameterisation)
# Point mass at 1; continuous part on (0, 1)

test_that("oibeta2 passes inflated distribution checks (mu=0.3, phi=5, oneprob=0.2)", {
  check_inflated_dist(
    dfun         = doibeta2,
    pfun         = poibeta2,
    xs           = c(0.05, 0.2, 0.4, 0.6, 0.85),
    lower        = 0, upper = 1,
    point_masses = 1,
    mu = 0.3, phi = 5, oneprob = 0.2
  )
})

test_that("oibeta2 passes inflated distribution checks (mu=0.7, phi=10, oneprob=0.15)", {
  check_inflated_dist(
    dfun         = doibeta2,
    pfun         = poibeta2,
    xs           = c(0.1, 0.4, 0.6, 0.8, 0.95),
    lower        = 0, upper = 1,
    point_masses = 1,
    mu = 0.7, phi = 10, oneprob = 0.15
  )
})

test_that("oibeta2 AD gradient has no NaN", {
  check_ad_gradient(doibeta2, roibeta2, mu = 0.4, phi = 5, oneprob = 0.2)
})

Try the RTMBdist package in your browser

Any scripts or data that you put into this service are public.

RTMBdist documentation built on Oct. 31, 2026, 5:07 p.m.