Learn R Programming

CovTools (version 0.5.0)

DiagTest1: One-Sample Diagonality Tests for Covariance Matrix

Description

Given data, DiagTest1 performs Frequentist and Bayesian version of 1-sample test for diagonal entries of a Covariance matrix where the null hypothesis is $$H_0 : \sigma_{ij} = 0~\mathrm{for any}~i \neq j$$ and alternative hypothesis is \(H_1 : ~\mathrm{not}~H_0\) with \(\Sigma_n = (\sigma_{ij})\).

Usage

DiagTest1(data, alpha = 0.05, method = c("Lan15", "Cai11", "mxPBF"),
  ...)

Arguments

data

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

alpha

level of significance.

method

a name of test.

...

extra arguments to be passed along for each procedure. See below for details.

parameter method description
a0 "mxPBF" hyperparameter (see below for details)
b0 "mxPBF" hyperparameter (see below for details)

Value

a named list containing one of followings,

element method description
statistic Frequentist a test statistic value.
threshold Frequentist rejection criterion to be compared against test statistic.
reject Frequentist a logical; TRUE to reject null hypothesis, FALSE otherwise.

mxPBF

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, \tau_{ij}^2 I_n ).$$ Under \(H_0\), the prior is set as $$\tau_{ij}^2 \sim IG(a0, b0)$$ and under \(H_1\), priors are $$ a_{ij}|\tau_{ij}^2 \sim N(0, \tau_{ij}^2/(\gamma*||X_j||^2))$$ $$\tau_{ij}^2 \sim IG(a0, b0).$$

References

cai_limiting_2011CovTools

lan_testing_2015CovTools

lee_maximum_2018CovTools

Examples

Run this code
# NOT RUN {
## generate data from multivariate normal with trivial covariance.
data = matrix(rnorm(100*5), nrow=100)

## run test
DiagTest1(data, method="Cai11")
DiagTest1(data, method="Lan15")
DiagTest1(data, method="mxPBF")
DiagTest1(data, method="mxPBF", a0=5.0, b0=5.0) # change hyperparameters for mxPBF
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab