/Bayes

Code accompanying my ICPSR summer program course on Applied Bayesian Modeling.

Primary LanguageHTML

Applied Bayesian Modeling at ICPSR

R and JAGS code accompanying my ICPSR summer program course on Applied Bayesian Modeling. See http://www.jkarreth.net/bayes-icpsr.html for more information. Please feel free to fork and develop any code you see in this repository. If you notice a problem or have a question, please email me at jkarreth@albany.edu and/or create an issue with the respective file.

Modeling examples

Multilevel models

Diagnostics

  • diagnostics.R: This script shows a variety of ways to obtain diagnostics (traceplots, density plots, BGR, etc.) of JAGS/MCMC objects in R using the coda, superdiag, ggmcmc, and mcmcplots packages.

Model presentation

  • regression.table.R: example code to easily export JAGS/BUGS results to LaTeX or HTML. Based on my mcmctab function.
  • regression.dotplot.R: example code to easily make regression coefficient plots from JAGS/BUGS results.
  • Posterior-Plots.R: a function written by Kevin Reuning (participant in the 2015 Applied Bayes workshop at ICPSR) to create a coefficient dot plot with added posterior density.
  • interaction.instructions.R: code to plot marginal effects from a Bayesian linear model with an interaction term across the range of a moderating variable.
  • limited.dep.vars.funcs.R: a set of functions written by Eric Dunford (participant in the 2015 Applied Bayes workshop at ICPSR) to calculate and visualize predicted probabilities from Bayesian logit or probit models for observed and simulated data.
  • factor.dotplot.R: code to make a dot plot (with credible intervals) of a Bayesian factor score.