Description Usage Arguments Value Author(s) References Examples
View source: R/NormalNormalPosterior.r
Compute the posterior distribution in a conjugate normal model for known variance: Let X_1, …, X_n be a sample from a N(μ, σ^2) distribution, with σ assumed known. We assume a prior distribution on μ, namely N(ν, τ^2). The posterior distribution is then μ|x \sim N(μ_p, σ_p^2) with
μ_p = (1 / (σ^2 / n) + τ^{-2})^{-1} (\bar{x} / (σ^2/n) + ν / τ^2)
and
σ_p = (1 / (σ^2/n) + τ^{-2})^{-1}.
These formulas are available e.g. in Held (2014, p. 182).
1 | NormalNormalPosterior(datamean, sigma, n, nu, tau)
|
datamean |
Mean of the data. |
sigma |
(Known) standard deviation of the data. |
n |
Number of observations. |
nu |
Prior mean. |
tau |
Prior standard deviation. |
A list with the entries:
postmean |
Posterior mean. |
postsigma |
Posterior standard deviation. |
Kaspar Rufibach (maintainer)
kaspar.rufibach@roche.com
Held, L., Sabanes-Bove, D. (2014). Applied Statistical Inference. Springer.
1 2 3 4 5 6 7 8 9 10 11 12 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.