hdtest: Hypothesis Test for High-dimensional Data

Description Usage Arguments Value References Examples

View source: R/hdanova.R

Description

Test the mean or differences of means of high-dimensional vectors are zero or not.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
hdtest(
  X,
  alpha = 0.05,
  side = "==",
  tau = 1/(1 + exp(-0.8 * seq(-6, 5, by = 1))),
  B = ceiling(50/alpha),
  pairs = NULL,
  Sig = NULL,
  verbose = F,
  tau.method = "MGB",
  R = 10 * ceiling(1/alpha),
  ncore = 1,
  cuda = T,
  nblock = 32,
  tpb = 64,
  seed = sample.int(2^30, 1),
  return.sci = F
)

Arguments

X

a matrix (one-sample) or a list of matrices (multiple-samples), with each row representing an observation.

alpha

significance level; default value: 0.05.

side

either of '<=','>=' or '=='; default value: '=='.

tau

real number(s) in the interval [0,1) that specifies the decay parameter and is automatically selected if it is set to NULL or multiple values are provided; default value: NULL, which is equivalent to tau=1/(1+exp(-0.8*seq(-6,5,by=1))).

B

the number of bootstrap replicates; default value: ceiling(50/alpha).

pairs

a matrix with two columns, only used when there are more than two populations, where each row specifies a pair of populations for which the SCI is constructed; default value: NULL, so that SCIs for all pairs are constructed.

Sig

a matrix (one-sample) or a list of matrices (multiple-samples), each of which is the covariance matrix of a sample; default value: NULL, so that it is automatically estimated from data.

verbose

TRUE/FALSE, indicator of whether to output diagnostic information or report progress; default value: FALSE.

tau.method

the method to select tau; possible values are 'MGB' (default), 'MGBA', 'RMGB','RMGBA', 'WB' and 'WBA' (see hdsci).

R

the number of Monte Carlo replicates for estimating the empirical size; default: ceiling(25/alpha)

ncore

the number of CPU cores to be used; default value: 1.

cuda

T/F to indicate whether to use CUDA GPU implementation when the package hdanova.cuda is installed. This option takes effect only when ncore=1.

nblock

the number of block in CUDA computation

tpb

number of threads per block; the maximum number of total number of parallel GPU threads is then nblock*tpb

seed

the seed for random number generator

return.sci

T/F, indicating whether to construct SCIs or not; default: FALSE.

Value

a list of the following objects:

tau

a vector of candidate values of the decay parameter.

side

the input side.

alpha

the input alpha.

pairs

a matrix of two columns, each row containing the a pair of indices of samples of which the SCI of the difference in mean is constructed.

sigma2

a vector (for one sample) or a list (for multiple samples) of vectors containing variance for each coordinate.

selected.tau

the selected value of the decay parameter from tau.

size.tau

the estimated size for each value in tau.

pvalue.tau

the p-value for each value in tau.

pvalue

the p-value of the test.

reject

a T/F value indicating whether the hypothesis is rejected.

accept

a T/F value indicating whether the hypothesis is accepted.

rej.paris

optionally gives the pairs of samples that lead to rejection.

sci

if return.sci=TRUE, then a constructed SCI constructed by using selected,tau, which is a list of the following objects:

sci.lower

a vector (when <= two samples) or a list of vectors (when >= 3 samples) specifying the lower bound of the SCI for the mean (one-sample) or the difference of means of each pair of samples.

sci.upper

a vector (when <= two samples) or a list of vectors (when >= 3 samples) specifying the upper bound of the SCI.

pairs

a matrix of two columns, each row containing the a pair of indices of samples of which the SCI of the difference in mean is constructed.

tau

the decay parameter that is used to construct the SCI.

Mn

the sorted (in increasing order) bootstrapped max statistic.

Ln

the sorted (in increasing order) bootstrapped min statistic.

side

the input side.

alpha

the input alpha.

References

\insertRef

Lopes2020hdanova

\insertRef

Lin2020hdanova

Examples

1
2
3
4
5
# simulate a dataset of 4 samples
X <- lapply(1:4, function(g) MASS::mvrnorm(30,rep(0.3*g,10),diag((1:10)^(-0.5*g))))

# test for the equality of mean vectors with pairs={(1,3),(2,4)}
hdtest(X,alpha=0.05,pairs=matrix(1:4,2,2),tau=c(0.4,0.5,0.6))$reject

linulysses/hdanova documentation built on Feb. 13, 2021, 9:10 a.m.