Conjugate update of a normal mixture prior across replicates
Source:R/vectorised_conjugate_inference.R
normal_mixture_posterior.RdApplies the normal-normal conjugate update to every replicate at
once. This is the vectorised equivalent of calling RBesT::postmix() once per
replicate: for a prior component with weight \(w_k\), mean \(\mu_k\) and
standard deviation \(s_k\), and an observation \((m_i, se_i)\), the
posterior component has variance \(1/(1/s_k^2 + 1/se_i^2)\), mean
\(v_{ik}(\mu_k/s_k^2 + m_i/se_i^2)\) and weight proportional to
\(w_k \, N(m_i; \mu_k, s_k^2 + se_i^2)\).
Arguments
- weights
Prior component weights. Either a vector of length
n_components(a prior shared by every replicate) or an_replicates x n_componentsmatrix (one prior per replicate, as needed by empirical Bayes methods).- means
Prior component means, shaped like
weights.- sds
Prior component standard deviations, shaped like
weights.- estimate
Vector of per-replicate treatment effect estimates.
- standard_error
Vector of per-replicate standard errors.