samesource_C: Fast computation of the Bayes Factor (same source v....

Description Usage Arguments Details Value Normal-Inverse-Wishart model Inverted Wishart parametrization (Press) References See Also

View source: R/samesource_cpp.R

Description

Implemented in C.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
samesource_C(
  quest,
  ref,
  n.iter,
  B.inv,
  W.inv.1,
  W.inv.2,
  U,
  nw,
  mu,
  burn.in,
  verbose = FALSE,
  marginals = FALSE
)

Arguments

quest

the questioned dataset (a n_q x p matrix)

ref

the reference dataset (a n_r x p matrix)

n.iter

number of MCMC iterations excluding burn-in

B.inv

prior inverse of between-source covariance matrix

W.inv.1

prior inverse of within-source covariance matrix (questioned items)

W.inv.2

prior inverse of within-source covariance matrix (reference items)

nw

degrees of freedom

mu

prior mean (p x 1)

burn.in

number of MCMC burn-in iterations

verbose

if TRUE, be verbose

marginals

if TRUE, also return the marginal likelihoods in the LR formula (default: FALSE)

Details

The hypothesis pair is:

See diwishart_inverse for the parametrization of the Inverted Wishart. See marginalLikelihood_internal for further documentation.

Value

the log-BF value (base e), or a list with the log-BF and the computed marginal likelihoods:

Normal-Inverse-Wishart model

Described in \insertCiteBozza2008Probabilisticbayessource.

Observation level:

Group level:

Hyperparameters:

Posterior samples of theta, W^{(-1)} can be generated with a Gibbs sampler.

Inverted Wishart parametrization (Press)

Uses \insertCitePress2012Appliedbayessource parametrization.

X ~ IW(v, S)

with S is a p x p matrix, v > 2p (the degrees of freedom).

Then:

E[X] = S/(n - 2(p + 1))

References

\insertAllCited

See Also

marginalLikelihood

Other core functions: bayessource-package, get_minimum_nw_IW(), make_priors_and_init(), marginalLikelihood_internal(), marginalLikelihood(), mcmc_postproc(), two.level.multivariate.calculate.UC()


lgaborini/bayessource documentation built on Nov. 9, 2021, 2:10 p.m.