triplot.normal.knownvariance function

Draw prior, data and posterior for a known variance normal distribution example

Draw prior, data and posterior for a known variance normal distribution example

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

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.

Author(s)

Fraenzi Korner-Nievergelt

See Also

dnorm

Examples

triplot.normal.knownvariance(theta.data=10, n=20, variance.known=5, prior.theta=0, prior.variance=100)
  • Maintainer: Fraenzi Korner-Nievergelt
  • License: GPL-2
  • Last published: 2019-12-05

Useful links