tests/testthat/test_ggfuns.R

context("gg functions")

test_that("ggfun", {
  set.seed(123)
  truth <- simulateData(N=100, p=c(0.1, 0.8, 0.1),
                        theta=c(-0.3, 0, 0.3), sds=c(0.2, 0.2, 0.2))
  mcmcParams(truth) <- McmcParams(iter=250, burnin=200, thin=1, nStarts=1)
  ## label switching
  expect_warning(model <- posteriorSimulation(truth))
  pred <- predictive(model)
  pred2 <- longFormatKB(pred, K=k(model), B=numBatch(model)) %>%
    set_colnames(c("s", "y", "b", "component")) %>%
    mutate(model=modelName(model))
  tmp <- ggMixture(model, bins=50)
  expect_is(tmp, "ggplot")
})

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.