cov2.mxPBF: Two-sample Covariance Test with Maximum Pairwise Bayes Factor

View source: R/cov2_mxPBF.R

cov2.mxPBFR Documentation

Two-sample Covariance Test with Maximum Pairwise Bayes Factor

Description

Not Written Here - No Reference Yet.

Usage

cov2.mxPBF(X, Y, a0 = 2, b0 = 2, gamma = 1, nthreads = 1)

Arguments

X

an (n_x \times p) data matrix of 1st sample.

Y

an (n_y \times p) data matrix of 2nd sample.

a0

shape parameter for inverse-gamma prior.

b0

scale parameter for inverse-gamma prior.

gamma

non-negative variance scaling parameter.

nthreads

number of threads for parallel execution via OpenMP.

Value

a (list) object of S3 class htest containing:

statistic

maximum of pairwise Bayes factor.

alternative

alternative hypothesis.

method

name of the test.

data.name

name(s) of provided sample data.

log.BF.mat

matrix of pairwise Bayes factors in natural log.

Examples

## Not run: 
## empirical Type 1 error with BF threshold = 20
niter   = 12345
counter = rep(0,niter)  # record p-values
for (i in 1:niter){
  X = matrix(rnorm(50*5), ncol=10)
  Y = matrix(rnorm(50*5), ncol=10)
  
  counter[i] = ifelse(cov2.mxPBF(X,Y)$statistic > 20, 1, 0)
}

## print the result
cat(paste("\n* Example for 'cov2.mxPBF'\n","*\n",
"* number of rejections   : ", sum(counter),"\n",
"* total number of trials : ", niter,"\n",
"* empirical Type 1 error : ",round(sum(counter/niter),5),"\n",sep=""))

## End(Not run)


kisungyou/SHT documentation built on Oct. 15, 2022, 3:18 p.m.