Skip to contents

The ‘iNZightBayes’ package uses simple Bayesian estimation methods to obtain summaries for some common problems, such as a sample mean or proportion, ANOVA (multiple means), and linear regression.

Grand mean of numeric variable

Here we are calculating the mean μ\mu and variance σ2\sigma^2 of a single numeric variable yy with length nn, using a Gibbs sampler. The model is p(μ,σ2|y)p(y|μ,σ2)p(μ)p(σ2)p(\mu,\sigma^2|y) \propto p(y|\mu,\sigma^2) p(\mu) p(\sigma^2) where the prior on μ\mu is Normal with mean μ0\mu_0 and variance σ02\sigma_0^2, and the prior on σ2\sigma^2 is Inverse-Gamma with parameters α\alpha and β\beta. The likelihood for yy is Normal with mean μ\mu and variance σ2\sigma^2.

Since these are conjugate, the full conditionals needed for Gibbs sampling are p(μ(i+1)|σ2,)=p(\mu^{(i+1)}|\sigma^2, \ldots) = \ldots

Group means of a numeric variable

Proportions of a categorical variable

Linear regression