tests/testthat/test_posteriors_bivariate_normal.R

# Currently takes about 30 seconds on an M1 mac
test_that("samplers are unbiased for bivariate normals", {
  skip_if_not(check_tf_version())

  hmc_mvn_samples <- check_mvn_samples(sampler = hmc())
  expect_lte(max(hmc_mvn_samples), stats::qnorm(0.99))

  rwmh_mvn_samples <- check_mvn_samples(sampler = rwmh())
  expect_lte(max(rwmh_mvn_samples), stats::qnorm(0.99))

  slice_mvn_samples <- check_mvn_samples(sampler = slice())
  expect_lte(max(rwmh_mvn_samples), stats::qnorm(0.99))
})

Try the greta package in your browser

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

greta documentation built on April 4, 2025, 12:37 a.m.