Learn R Programming

TeachBayes (version 0.1.0)

prior_post_plot: Graphs prior and posterior probabilities

Description

Graphs prior and posterior probabilities from a discrete Bayesian model

Usage

prior_post_plot(d,...)

Arguments

d
data frame where the first column are the model values, and the columns Prior and Posterior
...
gives an alternative label for the x axis

Value

Constructs a comparative plot of the prior and posterior distributions

Examples

Run this code
df <- data.frame(p=c(.1, .3, .5, .7, .9),
                 Prior=rep(1/5, 5))
y <- 5
n <- 10
df$Likelihood <- dbinom(y, prob=df$p, size=n)
df <- bayesian_crank(df)
prior_post_plot(df, "Proportion")

Run the code above in your browser using DataLab