Title: | Two-Sample Tests for High-Dimensional Mean Vectors |
---|---|
Description: | Provides various tests for comparing high-dimensional mean vectors in two sample populations. |
Authors: | Lifeng Lin and Wei Pan |
Maintainer: | Lifeng Lin <[email protected]> |
License: | GPL (>= 2) |
Version: | 3.0 |
Built: | 2024-12-15 07:24:43 UTC |
Source: | CRAN |
Provides various tests for comparing high-dimensional mean vectors in two sample populations.
Several two-sample tests for high-dimensional mean vectors have been proposed recently; see, e.g., Bai and Saranadasa (1996), Srivastava and Du (2008), Chen and Qin (2010), Cai et al (2014), and Chen et al (2014). However, these tests are powerful only against certain and limited alternative hypotheses. In practice, since the true alternative hypothesis is unknown, it is unclear how to choose one of these tests to yield high power. Accordingly, Pan et al (2014) and Xu et al (2016) proposed an adaptive test that may maintain high power across a wide range of situations; the asymptotic property of this test was also studied. This package provides functions to calculate p-values of the foregoing tests, using their asymptotic properties and the empirical (permutation or parametric bootstrap resampling) technique.
Lifeng Lin and Wei Pan
Maintainer: Lifeng Lin <[email protected]>
Bai ZD and Saranadasa H (1996). "Effect of high dimension: by an example of a two sample problem." Statistica Sinica, 6(2), 311–329.
Cai TT, Liu W, and Xia Y (2014). "Two-sample test of high dimensional means under dependence." Journal of the Royal Statistical Society: Series B (Statistical Methodology), 76(2), 349–372.
Chen SX and Qin YL (2010). "A two-sample test for high-dimensional data with applications to gene-set testing." The Annals of Statistics, 38(2), 808–835.
Chen SX, Li J, and Zhong PS (2014). "Two-Sample Tests for High Dimensional Means with Thresholding and Data Transformation." arXiv preprint arXiv:1410.2848.
Pan W, Kim J, Zhang Y, Shen X, and Wei P (2014). "A powerful and adaptive association test for rare variants." Genetics, 197(4), 1081–1095.
Srivastava MS and Du M (2008). "A test for the mean vector with fewer observations than the dimension." Journal of Multivariate Analysis, 99(3), 386–402.
Xu G, Lin L, Wei P, and Pan W (2016). "An adaptive two-sample test for high-dimensional means." Biometrika, 103(3), 609–624.
Calculates p-values of the sum-of-powers (SPU) and adaptive SPU (aSPU) tests based on the asymptotic distributions of the test statistics (Xu et al, 2016).
apval_aSPU(sam1, sam2, pow = c(1:6, Inf), eq.cov = TRUE, cov.est, cov1.est, cov2.est, bandwidth, bandwidth1, bandwidth2, cv.fold = 5, norm = "F")
apval_aSPU(sam1, sam2, pow = c(1:6, Inf), eq.cov = TRUE, cov.est, cov1.est, cov2.est, bandwidth, bandwidth1, bandwidth2, cv.fold = 5, norm = "F")
sam1 |
an n1 by p matrix from sample population 1. Each row represents a |
sam2 |
an n2 by p matrix from sample population 2. Each row represents a |
pow |
a numeric vector indicating the candidate powers |
eq.cov |
a logical value. The default is |
cov.est |
a consistent estimate of the common covariance matrix when |
cov1.est |
a consistent estimate of the covariance matrix of sample population 1 when |
cov2.est |
a consistent estimate of the covariance matrix of sample population 2 when |
bandwidth |
a vector of nonnegative integers indicating the candidate bandwidths to be used in the banding approach (Bickel and Levina, 2008) for estimating the common covariance when |
bandwidth1 |
similar with the argument |
bandwidth2 |
similar with the argument |
cv.fold |
an integer greater than or equal to 2 indicating the fold of cross-validation. The default is 5. See page 211 in Bickel and Levina (2008). |
norm |
a character string indicating the type of matrix norm for the calculation of risk function in cross-validation. This argument will be passed to the |
Suppose that the two groups of -dimensional independent and identically distributed samples
and
are observed; we consider high-dimensional data with
. Assume that the covariances of the two sample populations are
and
. The primary object is to test
versus
. Let
be the sample mean for group
. For a vector
, we denote
as its
th element.
For any , the sum-of-powers (SPU) test statistic is defined as:
For ,
The adaptive SPU (aSPU) test combines the SPU tests and improve the test power:
where is the p-value of SPU(
) test, and
is a candidate set of
's. Note that
is no longer a genuine p-value. The asymptotic properties of the SPU and aSPU tests are studied in Xu et al (2016).
A list including the following elements:
sam.info |
the basic information about the two groups of samples, including the samples sizes and dimension. |
pow |
the powers |
opt.bw |
the optimal bandwidth determined by the cross-validation when |
opt.bw1 |
the optimal bandwidth determined by the cross-validation when |
opt.bw2 |
the optimal bandwidth determined by the cross-validation when |
spu.stat |
the observed SPU test statistics. |
spu.e |
the asymptotic means of SPU test statistics with finite |
spu.var |
the asymptotic variances of SPU test statistics with finite |
spu.corr.odd |
the asymptotic correlations between SPU test statistics with odd |
spu.corr.even |
the asymptotic correlations between SPU test statistics with even |
cov.assumption |
the equality assumption on the covariances of the two sample populations; this was specified by the argument |
method |
this output reminds users that the p-values are obtained using the asymptotic distributions of test statistics. |
pval |
the p-values of the SPU tests and the aSPU test. |
Bickel PJ and Levina E (2008). "Regularized estimation of large covariance matrices." The Annals of Statistics, 36(1), 199–227.
Pan W, Kim J, Zhang Y, Shen X, and Wei P (2014). "A powerful and adaptive association test for rare variants." Genetics, 197(4), 1081–1095.
Pourahmadi M (2013). High-Dimensional Covariance Estimation. John Wiley & Sons, Hoboken, NJ.
Xu G, Lin L, Wei P, and Pan W (2016). "An adaptive two-sample test for high-dimensional means." Biometrika, 103(3), 609–624.
library(MASS) set.seed(1234) n1 <- n2 <- 50 p <- 200 mu1 <- rep(0, p) mu2 <- mu1 mu2[1:10] <- 0.2 true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) # use true covariance matrix apval_aSPU(sam1, sam2, cov.est = true.cov) # fix bandwidth as 10 apval_aSPU(sam1, sam2, bandwidth = 10) # use the optimal bandwidth from a candidate set #apval_aSPU(sam1, sam2, bandwidth = 0:20) # the two sample populations have different covariances #true.cov1 <- 0.2^(abs(outer(1:p, 1:p, "-"))) #true.cov2 <- 0.6^(abs(outer(1:p, 1:p, "-"))) #sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov1) #sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov2) #apval_aSPU(sam1, sam2, eq.cov = FALSE, # bandwidth1 = 10, bandwidth2 = 10)
library(MASS) set.seed(1234) n1 <- n2 <- 50 p <- 200 mu1 <- rep(0, p) mu2 <- mu1 mu2[1:10] <- 0.2 true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) # use true covariance matrix apval_aSPU(sam1, sam2, cov.est = true.cov) # fix bandwidth as 10 apval_aSPU(sam1, sam2, bandwidth = 10) # use the optimal bandwidth from a candidate set #apval_aSPU(sam1, sam2, bandwidth = 0:20) # the two sample populations have different covariances #true.cov1 <- 0.2^(abs(outer(1:p, 1:p, "-"))) #true.cov2 <- 0.6^(abs(outer(1:p, 1:p, "-"))) #sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov1) #sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov2) #apval_aSPU(sam1, sam2, eq.cov = FALSE, # bandwidth1 = 10, bandwidth2 = 10)
Calculates p-value of the test for testing equality of two-sample high-dimensional mean vectors proposed by Bai and Saranadasa (1996) based on the asymptotic distribution of the test statistic.
apval_Bai1996(sam1, sam2)
apval_Bai1996(sam1, sam2)
sam1 |
an n1 by p matrix from sample population 1. Each row represents a |
sam2 |
an n2 by p matrix from sample population 2. Each row represents a |
Suppose that the two groups of -dimensional independent and identically distributed samples
and
are observed; we consider high-dimensional data with
. Assume that the two groups share a common covariance matrix. The primary object is to test
versus
. Let
be the sample mean for group
. Also, let
be the pooled sample covariance matrix from the two groups.
Bai and Saranadasa (1996) proposed the following test statistic:
and its asymptotic distribution is normal under the null hypothesis.
A list including the following elements:
sam.info |
the basic information about the two groups of samples, including the samples sizes and dimension. |
cov.assumption |
this output reminds users that the two sample populations have a common covariance matrix. |
method |
this output reminds users that the p-values are obtained using the asymptotic distributions of test statistics. |
pval |
the p-value of the test proposed by Bai and Saranadasa (1996). |
The asymptotic distribution of the test statistic was derived under normality assumption in Bai and Saranadasa (1996). Also, this function assumes that the two sample populations have a common covariance matrix.
Bai ZD and Saranadasa H (1996). "Effect of high dimension: by an example of a two sample problem." Statistica Sinica, 6(2), 311–329.
library(MASS) set.seed(1234) n1 <- n2 <- 50 p <- 200 mu1 <- rep(0, p) mu2 <- mu1 mu2[1:10] <- 0.2 true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) apval_Bai1996(sam1, sam2)
library(MASS) set.seed(1234) n1 <- n2 <- 50 p <- 200 mu1 <- rep(0, p) mu2 <- mu1 mu2[1:10] <- 0.2 true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) apval_Bai1996(sam1, sam2)
Calculates p-value of the test for testing equality of two-sample high-dimensional mean vectors proposed by Cai et al (2014) based on the asymptotic distribution of the test statistic.
apval_Cai2014(sam1, sam2, eq.cov = TRUE)
apval_Cai2014(sam1, sam2, eq.cov = TRUE)
sam1 |
an n1 by p matrix from sample population 1. Each row represents a |
sam2 |
an n2 by p matrix from sample population 2. Each row represents a |
eq.cov |
a logical value. The default is |
Suppose that the two groups of -dimensional independent and identically distributed samples
and
are observed; we consider high-dimensional data with
. Assume that the covariances of the two sample populations are
and
. The primary object is to test
versus
. Let
be the sample mean for group
. For a vector
, we denote
as its
th element.
Cai et al (2014) proposed the following test statistic:
This test statistic follows an extreme value distribution under the null hypothesis.
A list including the following elements:
sam.info |
the basic information about the two groups of samples, including the samples sizes and dimension. |
cov.assumption |
the equality assumption on the covariances of the two sample populations; this was specified by the argument |
method |
this output reminds users that the p-values are obtained using the asymptotic distributions of test statistics. |
pval |
the p-value of the test proposed by Cai et al (2014). |
This function does not transform the data with their precision matrix (see Cai et al, 2014). To calculate the p-value of the test statisic with transformation, users can use transformed samples for sam1
and sam2
.
Cai TT, Liu W, and Xia Y (2014). "Two-sample test of high dimensional means under dependence." Journal of the Royal Statistical Society: Series B (Statistical Methodology), 76(2), 349–372.
library(MASS) set.seed(1234) n1 <- n2 <- 50 p <- 200 mu1 <- rep(0, p) mu2 <- mu1 mu2[1:10] <- 0.2 true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) apval_Cai2014(sam1, sam2) # the two sample populations have different covariances true.cov1 <- 0.2^(abs(outer(1:p, 1:p, "-"))) true.cov2 <- 0.6^(abs(outer(1:p, 1:p, "-"))) sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov1) sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov2) apval_Cai2014(sam1, sam2, eq.cov = FALSE)
library(MASS) set.seed(1234) n1 <- n2 <- 50 p <- 200 mu1 <- rep(0, p) mu2 <- mu1 mu2[1:10] <- 0.2 true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) apval_Cai2014(sam1, sam2) # the two sample populations have different covariances true.cov1 <- 0.2^(abs(outer(1:p, 1:p, "-"))) true.cov2 <- 0.6^(abs(outer(1:p, 1:p, "-"))) sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov1) sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov2) apval_Cai2014(sam1, sam2, eq.cov = FALSE)
Calculates p-value of the test for testing equality of two-sample high-dimensional mean vectors proposed by Chen and Qin (2010) based on the asymptotic distribution of the test statistic.
apval_Chen2010(sam1, sam2, eq.cov = TRUE)
apval_Chen2010(sam1, sam2, eq.cov = TRUE)
sam1 |
an n1 by p matrix from sample population 1. Each row represents a |
sam2 |
an n2 by p matrix from sample population 2. Each row represents a |
eq.cov |
a logical value. The default is |
Suppose that the two groups of -dimensional independent and identically distributed samples
and
are observed; we consider high-dimensional data with
. The primary object is to test
versus
. Let
be the sample mean for group
.
Chen and Qin (2010) proposed the following test statistic:
and its asymptotic distribution is normal under the null hypothesis.
A list including the following elements:
sam.info |
the basic information about the two groups of samples, including the samples sizes and dimension. |
cov.assumption |
the equality assumption on the covariances of the two sample populations; this was specified by the argument |
method |
this output reminds users that the p-values are obtained using the asymptotic distributions of test statistics. |
pval |
the p-value of the test proposed by Chen and Qin (2010). |
Chen SX and Qin YL (2010). "A two-sample test for high-dimensional data with applications to gene-set testing." The Annals of Statistics, 38(2), 808–835.
library(MASS) set.seed(1234) n1 <- n2 <- 50 p <- 200 mu1 <- rep(0, p) mu2 <- mu1 mu2[1:10] <- 0.2 true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) apval_Chen2010(sam1, sam2) # the two sample populations have different covariances true.cov1 <- 0.2^(abs(outer(1:p, 1:p, "-"))) true.cov2 <- 0.6^(abs(outer(1:p, 1:p, "-"))) sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov1) sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov2) apval_Chen2010(sam1, sam2, eq.cov = FALSE)
library(MASS) set.seed(1234) n1 <- n2 <- 50 p <- 200 mu1 <- rep(0, p) mu2 <- mu1 mu2[1:10] <- 0.2 true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) apval_Chen2010(sam1, sam2) # the two sample populations have different covariances true.cov1 <- 0.2^(abs(outer(1:p, 1:p, "-"))) true.cov2 <- 0.6^(abs(outer(1:p, 1:p, "-"))) sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov1) sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov2) apval_Chen2010(sam1, sam2, eq.cov = FALSE)
Calculates p-value of the test for testing equality of two-sample high-dimensional mean vectors proposed by Chen et al (2014) based on the asymptotic distribution of the test statistic.
apval_Chen2014(sam1, sam2, eq.cov = TRUE)
apval_Chen2014(sam1, sam2, eq.cov = TRUE)
sam1 |
an n1 by p matrix from sample population 1. Each row represents a |
sam2 |
an n2 by p matrix from sample population 2. Each row represents a |
eq.cov |
a logical value. The default is |
Suppose that the two groups of -dimensional independent and identically distributed samples
and
are observed; we consider high-dimensional data with
. Assume that the covariances of the two sample populations are
and
. The primary object is to test
versus
. Let
be the sample mean for group
. For a vector
, we denote
as its
th element.
Chen et al (2014) proposed removing estimated zero components in the mean difference through thresholding; they considered
where the threshold level is and
is the indicator function. Since an optimal choice of the threshold is unknown, they proposed trying all possible threshold values, then choosing the most significant one as their final test statistic:
where and
are estimates of the mean and standard deviation of
under the null hypothesis. They derived its asymptotic null distribution as an extreme value distribution.
A list including the following elements:
sam.info |
the basic information about the two groups of samples, including the samples sizes and dimension. |
cov.assumption |
the equality assumption on the covariances of the two sample populations; this was specified by the argument |
method |
this output reminds users that the p-values are obtained using the asymptotic distributions of test statistics. |
pval |
the p-value of the test proposed by Chen et al (2014). |
This function does not transform the data with their precision matrix (see Chen et al, 2014). To calculate the p-value of the test statisic with transformation, users can use transformed samples for sam1
and sam2
.
Chen SX, Li J, and Zhong PS (2014). "Two-Sample Tests for High Dimensional Means with Thresholding and Data Transformation." arXiv preprint arXiv:1410.2848.
library(MASS) set.seed(1234) n1 <- n2 <- 50 p <- 200 mu1 <- rep(0, p) mu2 <- mu1 mu2[1:10] <- 0.2 true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) apval_Chen2014(sam1, sam2) # the two sample populations have different covariances true.cov1 <- 0.2^(abs(outer(1:p, 1:p, "-"))) true.cov2 <- 0.6^(abs(outer(1:p, 1:p, "-"))) sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov1) sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov2) apval_Chen2014(sam1, sam2, eq.cov = FALSE)
library(MASS) set.seed(1234) n1 <- n2 <- 50 p <- 200 mu1 <- rep(0, p) mu2 <- mu1 mu2[1:10] <- 0.2 true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) apval_Chen2014(sam1, sam2) # the two sample populations have different covariances true.cov1 <- 0.2^(abs(outer(1:p, 1:p, "-"))) true.cov2 <- 0.6^(abs(outer(1:p, 1:p, "-"))) sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov1) sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov2) apval_Chen2014(sam1, sam2, eq.cov = FALSE)
Calculates p-value of the test for testing equality of two-sample high-dimensional mean vectors proposed by Srivastava and Du (2008) based on the asymptotic distribution of the test statistic.
apval_Sri2008(sam1, sam2)
apval_Sri2008(sam1, sam2)
sam1 |
an n1 by p matrix from sample population 1. Each row represents a |
sam2 |
an n2 by p matrix from sample population 2. Each row represents a |
Suppose that the two groups of -dimensional independent and identically distributed samples
and
are observed; we consider high-dimensional data with
. Assume that the two groups share a common covariance matrix. The primary object is to test
versus
. Let
be the sample mean for group
. Also, let
be the pooled sample covariance matrix from the two groups.
Srivastava and Du (2008) proposed the following test statistic:
where ,
's are the diagonal elements of
,
is the sample correlation matrix and
. This test statistic follows normal distribution under the null hypothesis.
A list including the following elements:
sam.info |
the basic information about the two groups of samples, including the samples sizes and dimension. |
cov.assumption |
this output reminds users that the two sample populations have a common covariance matrix. |
method |
this output reminds users that the p-values are obtained using the asymptotic distributions of test statistics. |
pval |
the p-value of the test proposed by Srivastava and Du (2008). |
The asymptotic distribution of the test statistic was derived under normality assumption in Bai and Saranadasa (1996). Also, this function assumes that the two sample populations have a common covariance matrix.
Srivastava MS and Du M (2008). "A test for the mean vector with fewer observations than the dimension." Journal of Multivariate Analysis, 99(3), 386–402.
library(MASS) set.seed(1234) n1 <- n2 <- 50 p <- 200 mu1 <- rep(0, p) mu2 <- mu1 mu2[1:10] <- 0.2 true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) apval_Sri2008(sam1, sam2)
library(MASS) set.seed(1234) n1 <- n2 <- 50 p <- 200 mu1 <- rep(0, p) mu2 <- mu1 mu2[1:10] <- 0.2 true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) apval_Sri2008(sam1, sam2)
Calculates p-values of the sum-of-powers (SPU) and adaptive SPU (aSPU) tests based on the combination of permutation method and asymptotic distributions of the test statistics (Xu et al, 2016).
cpval_aSPU(sam1, sam2, pow = c(1:6, Inf), n.iter = 1000, seeds)
cpval_aSPU(sam1, sam2, pow = c(1:6, Inf), n.iter = 1000, seeds)
sam1 |
an n1 by p matrix from sample population 1. Each row represents a |
sam2 |
an n2 by p matrix from sample population 2. Each row represents a |
pow |
a numeric vector indicating the candidate powers |
n.iter |
a numeric integer indicating the number of permutation iterations for calculating the means, variances, covariances of SPU test statistics' asymptotic distributions. The default is 1,000. |
seeds |
a vector of seeds for each permutation iteration; this is optional. |
Suppose that the two groups of -dimensional independent and identically distributed samples
and
are observed; we consider high-dimensional data with
. Assume that the covariances of the two sample populations are
and
. The primary object is to test
versus
. Let
be the sample mean for group
. For a vector
, we denote
as its
th element.
For any , the sum-of-powers (SPU) test statistic is defined as:
For ,
The adaptive SPU (aSPU) test combines the SPU tests and improve the test power:
where is the p-value of SPU(
) test, and
is a candidate set of
's. Note that
is no longer a genuine p-value.
The asymptotic properties of the SPU and aSPU tests are studied in Xu et al (2016). When using the theoretical means, variances, and covarainces of to calculate the p-values of SPU and aSPU tests (
), the high-dimensional covariance matrix of the samples needs to be consistently estimated; such estimation is usually time-consuming.
Alternatively, assuming that the two sample groups have same covariance, the permutation method can be applied to efficiently estimate the means, variances, and covarainces of 's asymptotic distributions, which then yield the p-values of SPU and aSPU tests based on the combination of permutation method and asymptotic distributions.
A list including the following elements:
sam.info |
the basic information about the two groups of samples, including the samples sizes and dimension. |
pow |
the powers |
spu.stat |
the observed SPU test statistics. |
spu.e |
the asymptotic means of SPU test statistics with finite |
spu.var |
the asymptotic variances of SPU test statistics with finite |
spu.corr.odd |
the asymptotic correlations between SPU test statistics with odd |
spu.corr.even |
the asymptotic correlations between SPU test statistics with even |
cov.assumption |
the equality assumption on the covariances of the two sample populations; this reminders users that |
method |
this output reminds users that the p-values are obtained using the asymptotic distributions of test statistics. |
pval |
the p-values of the SPU tests and the aSPU test. |
The permutation technique assumes that the distributions of the two sample populations are the same under the null hypothesis.
Bickel PJ and Levina E (2008). "Regularized estimation of large covariance matrices." The Annals of Statistics, 36(1), 199–227.
Pan W, Kim J, Zhang Y, Shen X, and Wei P (2014). "A powerful and adaptive association test for rare variants." Genetics, 197(4), 1081–1095.
Pourahmadi M (2013). High-Dimensional Covariance Estimation. John Wiley & Sons, Hoboken, NJ.
Xu G, Lin L, Wei P, and Pan W (2016). "An adaptive two-sample test for high-dimensional means." Biometrika, 103(3), 609–624.
library(MASS) set.seed(1234) n1 <- n2 <- 50 p <- 200 mu1 <- rep(0, p) mu2 <- mu1 mu2[1:10] <- 0.2 true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) cpval_aSPU(sam1, sam2, n.iter = 100)
library(MASS) set.seed(1234) n1 <- n2 <- 50 p <- 200 mu1 <- rep(0, p) mu2 <- mu1 mu2[1:10] <- 0.2 true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) cpval_aSPU(sam1, sam2, n.iter = 100)
Calculates p-values of the sum-of-powers (SPU) and adaptive SPU (aSPU) tests based on permutation or parametric bootstrap resampling.
epval_aSPU(sam1, sam2, pow = c(1:6, Inf), eq.cov = TRUE, n.iter = 1000, cov1.est, cov2.est, bandwidth1, bandwidth2, cv.fold = 5, norm = "F", seeds)
epval_aSPU(sam1, sam2, pow = c(1:6, Inf), eq.cov = TRUE, n.iter = 1000, cov1.est, cov2.est, bandwidth1, bandwidth2, cv.fold = 5, norm = "F", seeds)
sam1 |
an n1 by p matrix from sample population 1. Each row represents a |
sam2 |
an n2 by p matrix from sample population 2. Each row represents a |
pow |
a numeric vector indicating the candidate values for the power |
eq.cov |
a logical value. The default is |
n.iter |
a numeric integer indicating the number of permutation/resampling iterations. The default is 1,000. |
cov1.est |
This and the following arguments are only effective when |
cov2.est |
a consistent estimate of the covariance matrix of sample population 2 when |
bandwidth1 |
a vector of nonnegative integers indicating the candidate bandwidths to be used in the banding approach (Bickel and Levina, 2008) for estimating the covariance of sample population 1 when |
bandwidth2 |
similar with the argument |
cv.fold |
an integer greater than or equal to 2 indicating the fold of cross-validation. The default is 5. See page 211 in Bickel and Levina (2008). |
norm |
a character string indicating the type of matrix norm for the calculation of risk function in cross-validation. This argument will be passed to the |
seeds |
a vector of seeds for each permutation or parametric bootstrap resampling iteration; this is optional. |
See the details in apval_aSPU
.
A list including the following elements:
sam.info |
the basic information about the two groups of samples, including the samples sizes and dimension. |
pow |
the powers |
opt.bw1 |
the optimal bandwidth determined by the cross-validation when |
opt.bw2 |
the optimal bandwidth determined by the cross-validation when |
cov.assumption |
the equality assumption on the covariances of the two sample populations; this was specified by the argument |
method |
this output reminds users that the p-values are obtained using permutation or parametric bootstrap resampling. |
pval |
the p-values of the SPU tests and the aSPU test. |
Bickel PJ and Levina E (2008). "Regularized estimation of large covariance matrices." The Annals of Statistics, 36(1), 199–227.
Pan W, Kim J, Zhang Y, Shen X, and Wei P (2014). "A powerful and adaptive association test for rare variants." Genetics, 197(4), 1081–1095.
Pourahmadi M (2013). High-Dimensional Covariance Estimation. John Wiley & Sons, Hoboken, NJ.
Xu G, Lin L, Wei P, and Pan W (2016). "An adaptive two-sample test for high-dimensional means." Biometrika, 103(3), 609–624.
library(MASS) set.seed(1234) n1 <- n2 <- 50 p <- 200 mu1 <- rep(0, p) mu2 <- mu1 mu2[1:10] <- 0.2 true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) # increase n.iter to reduce Monte Carlo error epval_aSPU(sam1, sam2, n.iter = 10) # the two sample populations have different covariances #true.cov1 <- 0.2^(abs(outer(1:p, 1:p, "-"))) #true.cov2 <- 0.6^(abs(outer(1:p, 1:p, "-"))) #sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov1) #sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov2) # increase n.iter to reduce Monte Carlo error #epval_aSPU(sam1, sam2, eq.cov = FALSE, n.iter = 10, # bandwidth1 = 10, bandwidth2 = 10)
library(MASS) set.seed(1234) n1 <- n2 <- 50 p <- 200 mu1 <- rep(0, p) mu2 <- mu1 mu2[1:10] <- 0.2 true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) # increase n.iter to reduce Monte Carlo error epval_aSPU(sam1, sam2, n.iter = 10) # the two sample populations have different covariances #true.cov1 <- 0.2^(abs(outer(1:p, 1:p, "-"))) #true.cov2 <- 0.6^(abs(outer(1:p, 1:p, "-"))) #sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov1) #sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov2) # increase n.iter to reduce Monte Carlo error #epval_aSPU(sam1, sam2, eq.cov = FALSE, n.iter = 10, # bandwidth1 = 10, bandwidth2 = 10)
Calculates p-value of the test for testing equality of two-sample high-dimensional mean vectors proposed by Bai and Saranadasa (1996) based on permutation.
epval_Bai1996(sam1, sam2, n.iter = 1000, seeds)
epval_Bai1996(sam1, sam2, n.iter = 1000, seeds)
sam1 |
an n1 by p matrix from sample population 1. Each row represents a |
sam2 |
an n2 by p matrix from sample population 2. Each row represents a |
n.iter |
a numeric integer indicating the number of permutation iterations. The default is 1,000. |
seeds |
a vector of seeds for each permutation or parametric bootstrap resampling iteration; this is optional. |
See the details in apval_Bai1996
.
A list including the following elements:
sam.info |
the basic information about the two groups of samples, including the samples sizes and dimension. |
cov.assumption |
this output reminds users that the two sample populations have a common covariance matrix. |
method |
this output reminds users that the p-values are obtained using permutation. |
pval |
the p-value of the test proposed by Bai and Saranadasa (1996). |
The permutation technique assumes that the distributions of the two sample populations are the same under the null hypothesis.
Bai ZD and Saranadasa H (1996). "Effect of high dimension: by an example of a two sample problem." Statistica Sinica, 6(2), 311–329.
#library(MASS) #set.seed(1234) #n1 <- n2 <- 50 #p <- 200 #mu1 <- rep(0, p) #mu2 <- mu1 #mu2[1:10] <- 0.2 #true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance #sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) #sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) # increase n.iter to reduce Monte Carlo error. #epval_Bai1996(sam1, sam2, n.iter = 10)
#library(MASS) #set.seed(1234) #n1 <- n2 <- 50 #p <- 200 #mu1 <- rep(0, p) #mu2 <- mu1 #mu2[1:10] <- 0.2 #true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance #sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) #sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) # increase n.iter to reduce Monte Carlo error. #epval_Bai1996(sam1, sam2, n.iter = 10)
Calculates p-value of the test for testing equality of two-sample high-dimensional mean vectors proposed by Cai et al (2014) based on permutation or parametric bootstrap resampling.
epval_Cai2014(sam1, sam2, eq.cov = TRUE, n.iter = 1000, cov1.est, cov2.est, bandwidth1, bandwidth2, cv.fold = 5, norm = "F", seeds)
epval_Cai2014(sam1, sam2, eq.cov = TRUE, n.iter = 1000, cov1.est, cov2.est, bandwidth1, bandwidth2, cv.fold = 5, norm = "F", seeds)
sam1 |
an n1 by p matrix from sample population 1. Each row represents a |
sam2 |
an n2 by p matrix from sample population 2. Each row represents a |
eq.cov |
a logical value. The default is |
n.iter |
a numeric integer indicating the number of permutation/resampling iterations. The default is 1,000. |
cov1.est |
This and the following arguments are only effective when |
cov2.est |
a consistent estimate of the covariance matrix of sample population 2 when |
bandwidth1 |
a vector of nonnegative integers indicating the candidate bandwidths to be used in the banding approach (Bickel and Levina, 2008) for estimating the covariance of sample population 1 when |
bandwidth2 |
similar with the argument |
cv.fold |
an integer greater than or equal to 2 indicating the fold of cross-validation. The default is 5. See page 211 in Bickel and Levina (2008). |
norm |
a character string indicating the type of matrix norm for the calculation of risk function in cross-validation. This argument will be passed to the |
seeds |
a vector of seeds for each permutation or parametric bootstrap resampling iteration; this is optional. |
See the details in apval_Cai2014
.
A list including the following elements:
sam.info |
the basic information about the two groups of samples, including the samples sizes and dimension. |
opt.bw1 |
the optimal bandwidth determined by the cross-validation when |
opt.bw2 |
the optimal bandwidth determined by the cross-validation when |
cov.assumption |
the equality assumption on the covariances of the two sample populations; this was specified by the argument |
method |
this output reminds users that the p-values are obtained using permutation or parametric bootstrap resampling. |
pval |
the p-value of the test proposed by Cai et al (2014). |
This function does not transform the data with their precision matrix (see Cai et al, 2014). To calculate the p-value of the test statisic with transformation, users can input transformed samples to sam1
and sam2
.
Bickel PJ and Levina E (2008). "Regularized estimation of large covariance matrices." The Annals of Statistics, 36(1), 199–227.
Cai TT, Liu W, and Xia Y (2014). "Two-sample test of high dimensional means under dependence." Journal of the Royal Statistical Society: Series B (Statistical Methodology), 76(2), 349–372.
Pourahmadi M (2013). High-Dimensional Covariance Estimation. John Wiley & Sons, Hoboken, NJ.
#library(MASS) #set.seed(1234) #n1 <- n2 <- 50 #p <- 200 #mu1 <- rep(0, p) #mu2 <- mu1 #mu2[1:10] <- 0.2 #true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance #sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) #sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) # increase n.iter to reduce Monte Carlo error #epval_Cai2014(sam1, sam2, n.iter = 10) # the two sample populations have different covariances #true.cov1 <- 0.2^(abs(outer(1:p, 1:p, "-"))) #true.cov2 <- 0.6^(abs(outer(1:p, 1:p, "-"))) #sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov1) #sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov2) # increase n.iter to reduce Monte Carlo error #epval_Cai2014(sam1, sam2, eq.cov = FALSE, n.iter = 10, # bandwidth1 = 10, bandwidth2 = 10)
#library(MASS) #set.seed(1234) #n1 <- n2 <- 50 #p <- 200 #mu1 <- rep(0, p) #mu2 <- mu1 #mu2[1:10] <- 0.2 #true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance #sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) #sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) # increase n.iter to reduce Monte Carlo error #epval_Cai2014(sam1, sam2, n.iter = 10) # the two sample populations have different covariances #true.cov1 <- 0.2^(abs(outer(1:p, 1:p, "-"))) #true.cov2 <- 0.6^(abs(outer(1:p, 1:p, "-"))) #sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov1) #sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov2) # increase n.iter to reduce Monte Carlo error #epval_Cai2014(sam1, sam2, eq.cov = FALSE, n.iter = 10, # bandwidth1 = 10, bandwidth2 = 10)
Calculates p-value of the test for testing equality of two-sample high-dimensional mean vectors proposed by Chen and Qin (2010) based on permutation or parametric bootstrap resampling.
epval_Chen2010(sam1, sam2, eq.cov = TRUE, n.iter = 1000, cov1.est, cov2.est, bandwidth1, bandwidth2, cv.fold = 5, norm = "F", seeds)
epval_Chen2010(sam1, sam2, eq.cov = TRUE, n.iter = 1000, cov1.est, cov2.est, bandwidth1, bandwidth2, cv.fold = 5, norm = "F", seeds)
sam1 |
an n1 by p matrix from sample population 1. Each row represents a |
sam2 |
an n2 by p matrix from sample population 2. Each row represents a |
eq.cov |
a logical value. The default is |
n.iter |
a numeric integer indicating the number of permutation/resampling iterations. The default is 1,000. |
cov1.est |
This and the following arguments are only effective when |
cov2.est |
a consistent estimate of the covariance matrix of sample population 2 when |
bandwidth1 |
a vector of nonnegative integers indicating the candidate bandwidths to be used in the banding approach (Bickel and Levina, 2008) for estimating the covariance of sample population 1 when |
bandwidth2 |
similar with the argument |
cv.fold |
an integer greater than or equal to 2 indicating the fold of cross-validation. The default is 5. See page 211 in Bickel and Levina (2008). |
norm |
a character string indicating the type of matrix norm for the calculation of risk function in cross-validation. This argument will be passed to the |
seeds |
a vector of seeds for each permutation or parametric bootstrap resampling iteration; this is optional. |
See the details in apval_Chen2010
.
A list including the following elements:
sam.info |
the basic information about the two groups of samples, including the samples sizes and dimension. |
opt.bw1 |
the optimal bandwidth determined by the cross-validation when |
opt.bw2 |
the optimal bandwidth determined by the cross-validation when |
cov.assumption |
the equality assumption on the covariances of the two sample populations; this was specified by the argument |
method |
this output reminds users that the p-values are obtained using permutation or parametric bootstrap resampling. |
pval |
the p-value of the test proposed by Chen and Qin (2010). |
Bickel PJ and Levina E (2008). "Regularized estimation of large covariance matrices." The Annals of Statistics, 36(1), 199–227.
Chen SX and Qin YL (2010). "A two-sample test for high-dimensional data with applications to gene-set testing." The Annals of Statistics, 38(2), 808–835.
Pourahmadi M (2013). High-Dimensional Covariance Estimation. John Wiley & Sons, Hoboken, NJ.
#library(MASS) #set.seed(1234) #n1 <- n2 <- 50 #p <- 200 #mu1 <- rep(0, p) #mu2 <- mu1 #mu2[1:10] <- 0.2 #true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance #sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) #sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) # increase n.iter to reduce Monte Carlo error. #epval_Chen2010(sam1, sam2, n.iter = 10) # the two sample populations have different covariances #true.cov1 <- 0.2^(abs(outer(1:p, 1:p, "-"))) #true.cov2 <- 0.6^(abs(outer(1:p, 1:p, "-"))) #sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov1) #sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov2) # increase n.iter to reduce Monte Carlo error #epval_Chen2010(sam1, sam2, eq.cov = FALSE, n.iter = 10, # bandwidth1 = 10, bandwidth2 = 10)
#library(MASS) #set.seed(1234) #n1 <- n2 <- 50 #p <- 200 #mu1 <- rep(0, p) #mu2 <- mu1 #mu2[1:10] <- 0.2 #true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance #sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) #sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) # increase n.iter to reduce Monte Carlo error. #epval_Chen2010(sam1, sam2, n.iter = 10) # the two sample populations have different covariances #true.cov1 <- 0.2^(abs(outer(1:p, 1:p, "-"))) #true.cov2 <- 0.6^(abs(outer(1:p, 1:p, "-"))) #sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov1) #sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov2) # increase n.iter to reduce Monte Carlo error #epval_Chen2010(sam1, sam2, eq.cov = FALSE, n.iter = 10, # bandwidth1 = 10, bandwidth2 = 10)
Calculates p-value of the test for testing equality of two-sample high-dimensional mean vectors proposed by Chen et al (2014) based on permutation or parametric bootstrap resampling.
epval_Chen2014(sam1, sam2, eq.cov = TRUE, n.iter = 1000, cov1.est, cov2.est, bandwidth1, bandwidth2, cv.fold = 5, norm = "F", seeds)
epval_Chen2014(sam1, sam2, eq.cov = TRUE, n.iter = 1000, cov1.est, cov2.est, bandwidth1, bandwidth2, cv.fold = 5, norm = "F", seeds)
sam1 |
an n1 by p matrix from sample population 1. Each row represents a |
sam2 |
an n2 by p matrix from sample population 2. Each row represents a |
eq.cov |
a logical value. The default is |
n.iter |
a numeric integer indicating the number of permutation/resampling iterations. The default is 1,000. |
cov1.est |
This and the following arguments are only effective when |
cov2.est |
a consistent estimate of the covariance matrix of sample population 2 when |
bandwidth1 |
a vector of nonnegative integers indicating the candidate bandwidths to be used in the banding approach (Bickel and Levina, 2008) for estimating the covariance of sample population 1 when |
bandwidth2 |
similar with the argument |
cv.fold |
an integer greater than or equal to 2 indicating the fold of cross-validation. The default is 5. See page 211 in Bickel and Levina (2008). |
norm |
a character string indicating the type of matrix norm for the calculation of risk function in cross-validation. This argument will be passed to the |
seeds |
a vector of seeds for each permutation or parametric bootstrap resampling iteration; this is optional. |
See the details in apval_Chen2014
.
A list including the following elements:
sam.info |
the basic information about the two groups of samples, including the samples sizes and dimension. |
opt.bw1 |
the optimal bandwidth determined by the cross-validation when |
opt.bw2 |
the optimal bandwidth determined by the cross-validation when |
cov.assumption |
the equality assumption on the covariances of the two sample populations; this was specified by the argument |
method |
this output reminds users that the p-values are obtained using permutation or parametric bootstrap resampling. |
pval |
the p-value of the test proposed by Chen et al (2014). |
This function does not transform the data with their precision matrix (see Chen et al, 2014). To calculate the p-value of the test statisic with transformation, users can input transformed samples to sam1
and sam2
.
Bickel PJ and Levina E (2008). "Regularized estimation of large covariance matrices." The Annals of Statistics, 36(1), 199–227.
Chen SX, Li J, and Zhong PS (2014). "Two-Sample Tests for High Dimensional Means with Thresholding and Data Transformation." arXiv preprint arXiv:1410.2848.
Pourahmadi M (2013). High-Dimensional Covariance Estimation. John Wiley & Sons, Hoboken, NJ.
#library(MASS) #set.seed(1234) #n1 <- n2 <- 50 #p <- 200 #mu1 <- rep(0, p) #mu2 <- mu1 #mu2[1:10] <- 0.2 #true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance #sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) #sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) # increase n.iter to reduce Monte Carlo error #epval_Chen2014(sam1, sam2, n.iter = 10) # the two sample populations have different covariances #true.cov1 <- 0.2^(abs(outer(1:p, 1:p, "-"))) #true.cov2 <- 0.6^(abs(outer(1:p, 1:p, "-"))) #sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov1) #sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov2) # increase n.iter to reduce Monte Carlo error #epval_Chen2014(sam1, sam2, eq.cov = FALSE, n.iter = 10, # bandwidth1 = 10, bandwidth2 = 10)
#library(MASS) #set.seed(1234) #n1 <- n2 <- 50 #p <- 200 #mu1 <- rep(0, p) #mu2 <- mu1 #mu2[1:10] <- 0.2 #true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance #sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) #sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) # increase n.iter to reduce Monte Carlo error #epval_Chen2014(sam1, sam2, n.iter = 10) # the two sample populations have different covariances #true.cov1 <- 0.2^(abs(outer(1:p, 1:p, "-"))) #true.cov2 <- 0.6^(abs(outer(1:p, 1:p, "-"))) #sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov1) #sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov2) # increase n.iter to reduce Monte Carlo error #epval_Chen2014(sam1, sam2, eq.cov = FALSE, n.iter = 10, # bandwidth1 = 10, bandwidth2 = 10)
Calculates p-value of the test for testing equality of two-sample high-dimensional mean vectors proposed by Srivastava and Du (1996) based on permutation.
epval_Sri2008(sam1, sam2, n.iter = 1000, seeds)
epval_Sri2008(sam1, sam2, n.iter = 1000, seeds)
sam1 |
an n1 by p matrix from sample population 1. Each row represents a |
sam2 |
an n2 by p matrix from sample population 2. Each row represents a |
n.iter |
a numeric integer indicating the number of permutation iterations. The default is 1,000. |
seeds |
a vector of seeds for each permutation or parametric bootstrap resampling iteration; this is optional. |
See the details in apval_Sri2008
.
A list including the following elements:
sam.info |
the basic information about the two groups of samples, including the samples sizes and dimension. |
cov.assumption |
this output reminds users that the two sample populations have a common covariance matrix. |
method |
this output reminds users that the p-values are obtained using permutation. |
pval |
the p-value of the test proposed by Srivastava and Du (2008). |
The permutation technique assumes that the distributions of the two sample populations are the same under the null hypothesis.
Srivastava MS and Du M (2008). "A test for the mean vector with fewer observations than the dimension." Journal of Multivariate Analysis, 99(3), 386–402.
#library(MASS) #set.seed(1234) #n1 <- n2 <- 50 #p <- 200 #mu1 <- rep(0, p) #mu2 <- mu1 #mu2[1:10] <- 0.2 #true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance #sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) #sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) # increase n.iter to reduce Monte Carlo error. #epval_Sri2008(sam1, sam2, n.iter = 10)
#library(MASS) #set.seed(1234) #n1 <- n2 <- 50 #p <- 200 #mu1 <- rep(0, p) #mu2 <- mu1 #mu2[1:10] <- 0.2 #true.cov <- 0.4^(abs(outer(1:p, 1:p, "-"))) # AR1 covariance #sam1 <- mvrnorm(n = n1, mu = mu1, Sigma = true.cov) #sam2 <- mvrnorm(n = n2, mu = mu2, Sigma = true.cov) # increase n.iter to reduce Monte Carlo error. #epval_Sri2008(sam1, sam2, n.iter = 10)