tests/testthat/test_log_ddirichlet.R

context("Copied ddirichlet function")

test_that("log_ddirichlet", {
  p <- c(0.81, 0.049, 0.141)
  alpha <- c(73, 4, 8)
  x.cpp <- log_ddirichlet_(p, alpha)
  x.gtools <- gtools::ddirichlet(p, alpha)
  expect_equal(exp(x.cpp), x.gtools)
})

Try the CNPBayes package in your browser

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

CNPBayes documentation built on May 6, 2019, 4:06 a.m.