Description Usage Arguments Value References Examples
View source: R/BDiagTest1.mxPBF.R
One-sample diagonality test can be stated with the null hypothesis
H_0 : σ_{ij} = 0~\mathrm{for any}~i \neq j
and alternative hypothesis H_1 : ~\mathrm{not}~H_0 with Σ_n = (σ_{ij}). Let X_i be the i-th column of data matrix. Under the maximum pairwise bayes factor framework, we have following hypothesis,
H_0: a_{ij}=0\quad \mathrm{versus. } \quad H_1: \mathrm{ not }~ H_0.
The model is
X_i | X_j \sim N_n( a_{ij}X_j, τ_{ij}^2 I_n ).
Under H_0, the prior is set as
τ_{ij}^2 \sim IG(a0, b0)
and under H_1, priors are
a_{ij}|τ_{ij}^2 \sim N(0, τ_{ij}^2/(γ*||X_j||^2))
τ_{ij}^2 \sim IG(a0, b0).
1 | BDiagTest1.mxPBF(data, a0 = 2, b0 = 2, gamma = 1)
|
data |
an (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. |
a named list containing:
(p\times p) matrix of pairwise log Bayes factors.
lee_maximum_2018CovTools
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.