Nothing
test_that("Inverse Gaussian distribution functions work accurately", {
# Density
d <- d_ig(c(1, 2), mu = 1.5, lambda = 3)
expect_equal(length(d), 2)
expect_true(all(d > 0))
# Log density
d_log <- d_ig(c(1, 2), mu = 1.5, lambda = 3, log = TRUE)
expect_equal(log(d), d_log)
# CDF
p <- p_ig(c(1, 2), mu = 1.5, lambda = 3)
expect_true(all(p >= 0 & p <= 1))
expect_true(p[1] < p[2])
# Quantiles
q <- q_ig(p, mu = 1.5, lambda = 3)
expect_equal(q, c(1, 2), tolerance = 1e-4)
# Random generation
set.seed(42)
r <- r_ig(100, mu = 2, lambda = 5)
expect_equal(length(r), 100)
expect_true(all(r > 0))
expect_equal(mean(r), 2, tolerance = 0.5)
# Edge cases
expect_equal(d_ig(-1, mu = 1, lambda = 1), 0)
expect_equal(p_ig(-1, mu = 1, lambda = 1), 0)
expect_equal(q_ig(0, mu = 1, lambda = 1), 0)
expect_equal(q_ig(1, mu = 1, lambda = 1), Inf)
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.