knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" ) library(ggformula) library(R2jags) library(CalvinBayes)
The goal of CalvinBayes is to collect up some data sets and utilities for learning/teaching Bayesian Data analysis.
You can install the development version of CalvinBayes from GitHub with
devtools::install_github("rpruim/CalvinBayes")
This package is not on CRAN.
Here is an example that demonstrates the use of the posterior()
function to extract
isamples from the posterior distribution of an object fit using the R2jags package.
library(R2jags) library(CalvinBayes) data("z15N50") glimpse(z15N50)
# describe the model bern_model <- function() { for (i in 1:N) { # each response is Bernoulli with fixed parameter theta y[i] ~ dbern(theta) } theta ~ dbeta(1, 1) # prior for theta }
# Fit the model bern_jags <- jags( data = list(y = z15N50$y, N = nrow(z15N50)), model.file = bern_model, parameters.to.save = c("theta") )
glimpse(posterior(bern_jags)) library(ggformula) gf_density(~ theta, data = posterior(bern_jags))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.