This 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
)

Arguments

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 chain_output = TRUE.

Normal-Inverse-Wishart model

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.

See also