Learn R Programming

LearnBayes (version 2.15.1)

Functions for Learning Bayesian Inference

Description

A collection of functions helpful in learning the basic tenets of Bayesian statistical inference. It contains functions for summarizing basic one and two parameter posterior distributions and predictive distributions. It contains MCMC algorithms for summarizing posterior distributions defined by the user. It also contains functions for regression models, hierarchical models, Bayesian tests, and illustrations of Gibbs sampling.

Copy Link

Version

Install

install.packages('LearnBayes')

Monthly Downloads

5,667

Version

2.15.1

License

GPL (>= 2)

Maintainer

Jim Albert

Last Published

March 18th, 2018

Functions in LearnBayes (2.15.1)

bayes.model.selection

Bayesian regression model selection using G priors
betabinexch

Log posterior of logit mean and log precision for Binomial/beta exchangeable model
baseball.1964

Team records in the 1964 National League baseball season
bayes.probit

Simulates from a probit binary response regression model using data augmentation and Gibbs sampling
bermuda.grass

Bermuda grass experiment data
blinregexpected

Simulates values of expected response for linear regression model
betabinexch0

Log posterior of mean and precision for Binomial/beta exchangeable model
binomial.beta.mix

Computes the posterior for binomial sampling and a mixture of betas prior
bayesresiduals

Computation of posterior residual outlying probabilities for a linear regression model
blinregpred

Simulates values of predicted response for linear regression model
bfexch

Logarithm of integral of Bayes factor for testing homogeneity of proportions
beta.select

Selection of Beta Prior Given Knowledge of Two Quantiles
birdextinct

Bird measurements from British islands
bfindep

Bayes factor against independence assuming alternatives close to independence
bprobit.probs

Simulates fitted probabilities for a probit regression model
achievement

School achievement data
cauchyerrorpost

Log posterior of median and log scale parameters for Cauchy sampling
bradley.terry.post

Log posterior of a Bradley Terry random effects model
breastcancer

Survival experience of women with breast cancer under treatment
bayes.influence

Observation sensitivity analysis in beta-binomial model
ctable

Bayes factor against independence using uniform priors
chemotherapy

Chemotherapy treatment effects on ovarian cancer
calculus.grades

Calculus grades dataset
darwin

Darwin's data on plants
discint

Highest probability interval for a discrete distribution
groupeddatapost

Log posterior of normal parameters when data is in grouped form
dmt

Probability density function for multivariate t
birthweight

Birthweight regression study
discrete.bayes.2

Posterior distribution of two parameters with discrete priors
hearttransplants

Heart transplant mortality data
donner

Donner survival study
jeter2004

Hitting data for Derek Jeter
hiergibbs

Gibbs sampling for a hierarchical regression model
blinreg

Simulation from Bayesian linear regression model
laplace

Summarization of a posterior density by the Laplace method
logpoissnormal

Log posterior with Poisson sampling and normal prior
normal.select

Selection of Normal Prior Given Knowledge of Two Quantiles
histprior

Density function of a histogram distribution
election.2008

Poll data from 2008 U.S. Presidential Election
marathontimes

Marathon running times
normchi2post

Log posterior density for mean and variance for normal sampling
election

Florida election data
cancermortality

Cancer mortality data
indepmetrop

Independence Metropolis independence chain of a posterior distribution
normpostsim

Simulation from Bayesian normal sampling model
pdisc

Posterior distribution for a proportion with discrete priors
careertraj.setup

Setup for Career Trajectory Application
iowagpa

Admissions data for an university
ordergibbs

Gibbs sampling for a hierarchical regression model
pdiscp

Predictive distribution for a binomial sample with a discrete prior
mycontour

Contour plot of a bivariate density function
discrete.bayes

Posterior distribution with discrete priors
mnormt.onesided

Bayesian test of one-sided hypothesis about a normal mean
normal.normal.mix

Computes the posterior for normal sampling and a mixture of normals prior
rmnorm

Random number generation for multivariate normal
dmnorm

The probability density function for the multivariate normal (Gaussian) probability distribution
footballscores

Game outcomes and point spreads for American football
mnormt.twosided

Bayesian test of a two-sided hypothesis about a normal mean
rmt

Random number generation for multivariate t
lbinorm

Logarithm of bivariate normal density
gibbs

Metropolis within Gibbs sampling algorithm of a posterior distribution
rwmetrop

Random walk Metropolis algorithm of a posterior distribution
poissgamexch

Log posterior of Poisson/gamma exchangeable model
howardprior

Logarithm of Howard's dependent prior for two proportions
logctablepost

Log posterior of difference and sum of logits in a 2x2 table
schmidt

Batting data for Mike Schmidt
impsampling

Importance sampling using a t proposal density
poisson.gamma.mix

Computes the posterior for Poisson sampling and a mixture of gammas prior
studentdata

Student dataset
logisticpost

Log posterior for a binary response model with a logistic link and a uniform prior
normnormexch

Log posterior of mean and log standard deviation for Normal/Normal exchangeable model
rejectsampling

Rejecting sampling using a t proposal density
transplantpost

Log posterior of a Pareto model for survival data
normpostpred

Posterior predictive simulation from Bayesian normal sampling model
logpoissgamma

Log posterior with Poisson sampling and gamma prior
sir

Sampling importance resampling
predplot

Plot of predictive distribution for binomial sampling with a beta prior
rigamma

Random number generation for inverse gamma distribution
pbetap

Predictive distribution for a binomial sample with a beta prior
prior.two.parameters

Construct discrete uniform prior for two parameters
regroup

Collapses a matrix by summing over rows
sluggerdata

Hitting statistics for ten great baseball players
pbetat

Bayesian test of a proportion
soccergoals

Goals scored by professional soccer team
robustt

Gibbs sampling for a robust regression model
reg.gprior.post

Computes the log posterior of a normal regression model with a g prior.
rtruncated

Simulates from a truncated probability distribution
stanfordheart

Data from Stanford Heart Transplanation Program
puffin

Bird measurements from British islands
strikeout

Baseball strikeout data
rdirichlet

Random draws from a Dirichlet distribution
triplot

Plot of prior, likelihood and posterior for a proportion
simcontour

Simulated draws from a bivariate density function on a grid
weibullregpost

Log posterior of a Weibull proportional odds model for survival data