Skip to contents

Run the coin.tppl TreePPL program using the created input data.

coinflips <- tibble(coinflips = sample(c(TRUE, FALSE), 20, replace = TRUE))

input <- treeppl_input(coinflips)

output <- run_treeppl(dir = system.file("extdata", package = "treepplr"), 
                      source = "coin.tppl", data = input, samples = 100)

Plot the posterior distribution (normalized weights).

if(rlang::is_installed("ggplot2")) {
  ggplot(output) +
  geom_col(aes(samples, nweights), width = 0.005) +
  theme_bw()
}