Description Usage Arguments Value Examples
View source: R/update_normal_gamma.R
The conjugate model is (x| mu,tau) ~ Normal(mu, tau); (mu, tau) ~ Normal-Gamma(mu0,v0,alpha0,beta0) See wikipedia for details https://en.wikipedia.org/wiki/Conjugate_prior
1 2 3 4 5 6 7 8 | update_normal_gamma(
suff_stat_data,
mu0,
v0,
alpha0,
beta0,
sufficient_statistics
)
|
suff_stat_data |
a vector of sufficient statistics: sample_size, sample_mean and sample_sd. If sufficient_statistics = |
mu0 |
prior hyperparameter mu0 for the normal-gamma distribution |
v0 |
prior hyperparameter v0 for the normal-gamma distribution |
alpha0 |
prior hyperparameter alpha0 for the normal-gamma distribution |
beta0 |
prior hyperparameter beta0 for the normal-gamma distribution |
sufficient_statistics |
logical; if |
param A list with the prior and posterior hyperparameters. It constains the following components
A list with the prior hyperparameters mu, v, alpha, beta
A list with the posterior hyperparameters mu, v, alpha, beta
1 2 3 | dta <- rnorm(100)
update_normal_gamma(suff_stat_data = dta, mu0 = 0,
v0 = 5, alpha0 = 1, beta0 = 1, sufficient_statistics = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.