BDiagTest1.mxPBF {CovTools}R Documentation

One-Sample Diagonality Test by Maximum Pairwise Bayes Factor

Description

One-sample diagonality test can be stated with the null hypothesis

H0:σij=0 forany ijH_0 : \sigma_{ij} = 0~\mathrm{for any}~i \neq j

and alternative hypothesis H1: not H0H_1 : ~\mathrm{not}~H_0 with Σn=(σij)\Sigma_n = (\sigma_{ij}). Let XiX_i be the ii-th column of data matrix. Under the maximum pairwise bayes factor framework, we have following hypothesis,

H0:aij=0versus.H1:not H0.H_0: a_{ij}=0\quad \mathrm{versus. } \quad H_1: \mathrm{ not }~ H_0.

The model is

XiXjNn(aijXj,τij2In).X_i | X_j \sim N_n( a_{ij}X_j, \tau_{ij}^2 I_n ).

Under H0H_0, the prior is set as

τij2IG(a0,b0)\tau_{ij}^2 \sim IG(a0, b0)

and under H1H_1, priors are

aijτij2N(0,τij2/(γXj2)) a_{ij}|\tau_{ij}^2 \sim N(0, \tau_{ij}^2/(\gamma*||X_j||^2))

τij2IG(a0,b0).\tau_{ij}^2 \sim IG(a0, b0).

Usage

BDiagTest1.mxPBF(data, a0 = 2, b0 = 2, gamma = 1)

Arguments

data

an (n×p)(n\times p) data matrix where each row is an observation.

a0

shape parameter for inverse-gamma prior.

b0

scale parameter for inverse-gamma prior.

gamma

non-negative number. See the equation above.

Value

a named list containing:

log.BF.mat

(p×p)(p\times p) matrix of pairwise log Bayes factors.

References

Lee K, Lin L, Dunson D (2018). “Maximum Pairwise Bayes Factors for Covariance Structure Testing.” arXiv preprint. https://arxiv.org/abs/1809.03105.

Examples

## Not run: 
## generate data from multivariate normal with trivial covariance.
pdim = 10
data = matrix(rnorm(100*pdim), nrow=100)

## run test
## run mxPBF-based test
out1 = BDiagTest1.mxPBF(data)
out2 = BDiagTest1.mxPBF(data, a0=5.0, b0=5.0) # change some params

## visualize two Bayes Factor matrices
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,2), pty="s")
image(exp(out1$log.BF.mat)[,pdim:1], main="default")
image(exp(out2$log.BF.mat)[,pdim:1], main="a0=b0=5.0")
par(opar)

## End(Not run)


[Package CovTools version 0.5.4 Index]