marginalLikelihood_internal.RdThis is the numerator of the Bayes factor: assume that all observations come from the same source. To be called by the R wrapper.
marginalLikelihood_internal( X, n_iter, B_inv, W_inv, U, nw, mu, burn_in, chain_output = FALSE, verbose = FALSE, Gibbs_only = FALSE )
| X | the observation matrix (\(n \times p\): n = observation, p = variables) @param U covariance matrix for the mean (\(p \times p\)) |
|---|---|
| n_iter | number of MCMC iterations excluding burn-in |
| B_inv | prior inverse of between-source covariance matrix |
| W_inv | initialization for prior inverse of within-source covariance matrix |
| nw | degrees of freedom |
| mu | prior mean (\(p \times 1\)) |
| burn_in | number of MCMC burn-in iterations |
| chain_output | if true, output the entire chain as a list (ML-value, samples from theta, samples from W_inv) |
| verbose | if TRUE, be verbose |
| Gibbs_only | if TRUE, only return the Gibbs posterior samples. Implies |
Described in (Bozza et al. 2008) .
Observation level:
$$X_{ij} \sim N_p(\theta_i, W_i)$$ (i = source, j = items from source)
Group level:
$$\theta_i \sim N_p(\mu, B)$$
$$W_i \sim IW_p(\nu_w, U)$$
Hyperparameters:
$$B, U, \nu_w, \mu$$
Posterior samples of \(\theta\), \(W^{(-1)}\) can be generated with a Gibbs sampler.
Other C++ functions:
chol2inv(),
diwishart_inverse(),
dmvnorm(),
inv_Cholesky_from_Cholesky(),
inv_sympd_tol(),
inv_triangular(),
isCholeskyOn(),
ldet_from_Cholesky(),
logCummeanExp(),
logCumsumExp(),
logSumExpMean(),
logSumExp(),
rmvnorm(),
rwish()
Other core functions:
bayessource-package,
get_minimum_nw_IW(),
make_priors_and_init(),
marginalLikelihood(),
mcmc_postproc(),
samesource_C(),
two.level.multivariate.calculate.UC()