Learn R Programming

blmeco (version 1.0)

triplot.normal.knownvariance: Draw prior, data and posterior for a known variance normal distribution example

Description

The function draws a normal prior distribution, the data and the posterior distribution in one plot. It serves as a tool to explore the influence of different prior on a hypotehtical set of normally distributed data

Usage

triplot.normal.knownvariance(theta.data, variance.known, n, prior.theta, prior.variance, 
legend = TRUE, ylim = c(0, max(yposterior)), legend.bty="n")

Arguments

theta.data
mean of the data
variance.known
known variance
n
sample size
prior.theta
mean of the prior distribution
prior.variance
variance of the prior distribution
legend
logical, if TRUE (default) a legend is drawn
ylim
ylim of the plot
legend.bty
box type of legend

References

Gelman, A., J. B. Carlin, H. S. Stern and D. B. Rubin (2004). Bayesian Data Analysis. New York, Chapman & Hall/CRC.

See Also

dnorm

Examples

Run this code
triplot.normal.knownvariance(theta.data=10, n=20, variance.known=5, 
   prior.theta=0, prior.variance=100)

Run the code above in your browser using DataLab