| Title: | Affine Invariant Tests of Multivariate Normality |
|---|---|
| Description: | Various affine invariant multivariate normality tests are provided. It is designed to accompany the survey article Ebner, B. and Henze, N. (2020) <doi:10.1007/s11749-020-00740-0> titled "Tests for multivariate normality -- a critical review with emphasis on weighted L^2-statistics". We implement new and time honoured L^2-type tests of multivariate normality, such as the Baringhaus-Henze-Epps-Pulley (BHEP) test, the Henze-Zirkler test, the test of Henze-Jiménes-Gamero, the test of Henze-Jiménes-Gamero-Meintanis, the test of Henze-Visage, the Dörr-Ebner-Henze test based on harmonic oscillator and the Dörr-Ebner-Henze test based on a double estimation in a PDE. Secondly, we include the measures of multivariate skewness and kurtosis by Mardia, Koziol, Malkovich and Afifi and Móri, Rohatgi and Székely, as well as the associated tests. Thirdly, we include the tests of multivariate normality by Cox and Small, the 'energy' test of Székely and Rizzo, the tests based on spherical harmonics by Manzotti and Quiroz and the test of Pudelko. All the functions and tests need the data to be a n x d matrix where n is the samplesize (number of rows) and d is the dimension (number of columns). |
| Authors: | Lucas Butsch [aut], Bruno Ebner [aut, cre], Jaco Visagie [ctb], Johann Siemens [ctb] |
| Maintainer: | Bruno Ebner <[email protected]> |
| License: | CC BY 4.0 |
| Version: | 1.4 |
| Built: | 2026-09-25 20:24:28 UTC |
| Source: | https://github.com/cran/mnt |
Various affine invariant multivariate normality tests are provided. It is designed to accompany the survey article Ebner, B. and Henze, N. (2020) doi:10.1007/s11749-020-00740-0 titled "Tests for multivariate normality – a critical review with emphasis on weighted L^2-statistics". We implement new and time honoured L^2-type tests of multivariate normality, such as the Baringhaus-Henze-Epps-Pulley (BHEP) test, the Henze-Zirkler test, the test of Henze-Jiménes-Gamero, the test of Henze-Jiménes-Gamero-Meintanis, the test of Henze-Visage, the Dörr-Ebner-Henze test based on harmonic oscillator and the Dörr-Ebner-Henze test based on a double estimation in a PDE. Secondly, we include the measures of multivariate skewness and kurtosis by Mardia, Koziol, Malkovich and Afifi and Móri, Rohatgi and Székely, as well as the associated tests. Thirdly, we include the tests of multivariate normality by Cox and Small, the 'energy' test of Székely and Rizzo, the tests based on spherical harmonics by Manzotti and Quiroz and the test of Pudelko. All the functions and tests need the data to be a n x d matrix where n is the samplesize (number of rows) and d is the dimension (number of columns).
The tests implemented in mnt are calibrated for independent
and identically distributed observations. Applying them to residuals
from fitted models requires additional justification, because parameter
estimation may change the null distribution and invalidate the usual
critical values. As discussed by Jimenez-Gamero (2020) and acknowledged
by Ebner and Henze (2020), validity depends on both the test and the
underlying model.
Maintainer: Bruno Ebner [email protected]
Authors:
Bruno Ebner [email protected]
Lucas Butsch [email protected]
Other contributors:
Jaco Visagie [email protected] [contributor]
Johann Siemens [email protected] [contributor]
Jimenez-Gamero, M. D. (2020). Comments on: Tests for multivariate normality—a critical review with emphasis on weighted L2-statistics. TEST, 29, 893–897. doi:10.1007/s11749-020-00742-y.
Ebner, B. and Henze, N. (2020). Rejoinder on: Tests for multivariate normality—a critical review with emphasis on weighted L2-statistics. TEST, 29, 911–913. doi:10.1007/s11749-020-00744-w.
This function returns the value of the statistic of the Baringhaus-Henze-Epps-Pulley (BHEP) test as in Henze and Wagner (1997).
BHEP(data, a = 1)BHEP(data, a = 1)
data |
a n x d matrix of d dimensional data vectors. |
a |
positive numeric number (tuning parameter). |
The test statistic is
Here, , , are the scaled residuals, is the sample mean and is the sample covariance matrix of the random vectors . To ensure that the computation works properly
is needed. If that is not the case the function returns an error.
value of the test statistic.
Henze, N., and Wagner, T. (1997), A new approach to the class of BHEP tests for multivariate normality, J. Multiv. Anal., 62:1–23, doi:10.1006/jmva.1997.1684
Epps T.W., Pulley L.B. (1983), A test for normality based on the empirical characteristic function, Biometrika, 70:723-726, doi:10.1093/biomet/70.3.723
BHEP(MASS::mvrnorm(50,c(0,1),diag(1,2)))BHEP(MASS::mvrnorm(50,c(0,1),diag(1,2)))
This function returns the (approximated) value of the test statistic of the test of Cox and Small (1978).
CS(data, Points = NULL)CS(data, Points = NULL)
data |
a n x d matrix of d dimensional data vectors. |
Points |
points for approximation of the maximum on the sphere. |
The test statistic is ,
where
.
Here, , , are the scaled residuals, is the sample mean and is the sample covariance matrix of the random vectors . To ensure that the computation works properly
is needed. If that is not the case the function returns an error. Note that the maximum functional has to be approximated by a discrete version, for details see Ebner (2012).
approximation of the value of the test statistic of the test of Cox and Small (1978).
Cox, D.R. and Small, N.J.H. (1978), Testing multivariate normality, Biometrika, 65:263–272.
Ebner, B. (2012), Asymptotic theory for the test for multivariate normality by Cox and Small, Journal of Multivariate Analysis, 111:368–379.
CS(MASS::mvrnorm(50,c(0,1),diag(1,2)))CS(MASS::mvrnorm(50,c(0,1),diag(1,2)))
This function returns the quantiles of a test statistic with optional tuning parameter.
cv.quan( samplesize, dimension, quantile, statistic, tuning = NULL, repetitions = 1e+05 )cv.quan( samplesize, dimension, quantile, statistic, tuning = NULL, repetitions = 1e+05 )
samplesize |
samplesize for which the empirical quantile should be calculated. |
dimension |
a natural number to specify the dimension of the multivariate normal distribution |
quantile |
a number between 0 and 1 to specify the quantile of the empirical distribution of the considered test |
statistic |
a function specifying the test statistic. |
tuning |
the tuning parameter of the test statistic. |
repetitions |
number of Monte Carlo runs. |
empirical quantile of the test statistic.
cv.quan(samplesize=10, dimension=2,quantile=0.95, statistic=BHEP, tuning=2.5, repetitions=1000)cv.quan(samplesize=10, dimension=2,quantile=0.95, statistic=BHEP, tuning=2.5, repetitions=1000)
Computes the test statistic of the DEH test.
DEHT(data, a = 1)DEHT(data, a = 1)
data |
a n x d numeric matrix of data values. |
a |
positive numeric number (tuning parameter). |
This functions evaluates the teststatistic with the given data and the specified tuning parameter a.
Each row of the data Matrix contains one of the n (multivariate) sample with dimension d. To ensure that the computation works properly
is needed. If that is not the case the test returns an error.
The value of the test statistic.
Dörr, P., Ebner, B., Henze, N. (2020) "Testing multivariate normality by zeros of the harmonic oscillator in characteristic function spaces", Scandinavian Journal of Statistics, 48(2): 456-501, doi:10.1111/sjos.12477.
DEHT(MASS::mvrnorm(50,c(0,1),diag(1,2)),a=1)DEHT(MASS::mvrnorm(50,c(0,1),diag(1,2)),a=1)
Computes the test statistic of the DEH based on a double estimation in PDE test.
DEHU(data, a)DEHU(data, a)
data |
a (d,n) numeric matrix containing the data. |
a |
positive numeric number (tuning parameter). |
This functions evaluates the teststatistic with the given data and the specified tuning parameter a.
Each row of the data Matrix contains one of the n (multivariate) sample with dimension d. To ensure that the computation works properly
is needed. If that is not the case the test returns an error.
The value of the test statistic.
Dörr, P., Ebner, B., Henze, N. (2021) "A new test of multivariate normality by a double estimation in a characterizing PDE" Metrika 84: 401-427, doi:10.1007/s00184-020-00795-x.
Computes the test statistic of the EHS test based on a multivariate Stein equation.
EHS(data, a = 1)EHS(data, a = 1)
data |
a (d,n) numeric matrix containing the data. |
a |
positive numeric number (tuning parameter). |
This functions evaluates the teststatistic with the given data and the specified tuning parameter a.
Each row of the data Matrix contains one of the n (multivariate) sample with dimension d. To ensure that the computation works properly
is needed. If that is not the case the test returns an error.
Note that a=Inf returns the limiting test statistic with value 2*MSkew + MRSSkew and a=0 returns the value of the limit statistic
The value of the test statistic.
Ebner, B., Henze, N., Strieder, D. (2022) "Testing normality in any dimension by Fourier methods in a multivariate Stein equation", The Canadian Journal of Statistics, 50(3): 992-1033, doi:10.1002/cjs.11670.
Computes the test statistic of the Henze-Jimenes-Gamero test.
HJG(data, a = 5)HJG(data, a = 5)
data |
a n x d numeric matrix of data values. |
a |
positive numeric number (tuning parameter). |
This functions evaluates the teststatistic with the given data and the specified tuning parameter a.
Each row of the data Matrix contains one of the n (multivariate) sample with dimension d. To ensure that the computation works properly
is needed. If that is not the case the function returns an error.
The value of the test statistic.
Henze, N., Jiménez-Gamero, M.D. (2019) "A new class of tests for multinormality with i.i.d. and garch data based on the empirical moment generating function", TEST, 28, 499-521, doi:10.1007/s11749-018-0589-z
HJG(MASS::mvrnorm(50,c(0,1),diag(1,2)),a=5)HJG(MASS::mvrnorm(50,c(0,1),diag(1,2)),a=5)
Computes the test statistic of the Henze-Jiménes-Gamero-Meintanis test.
HJM(data, a)HJM(data, a)
data |
a n x d numeric matrix of data values. |
a |
positive numeric number (tuning parameter). |
This functions evaluates the teststatistic with the given data and the specified tuning parameter a.
Each row of the data Matrix contains one of the n (multivariate) sample with dimension d. To ensure that the computation works properly
is needed. If that is not the case the function returns an error.
The value of the test statistic.
Henze, N., Jiménes-Gamero, M.D., Meintanis, S.G. (2019), Characterizations of multinormality and corresponding tests of fit, including for GARCH models, Econometric Th., 35:510–546, doi:10.1017/S0266466618000154.
HJM(MASS::mvrnorm(20,c(0,1),diag(1,2)),a=2.5)HJM(MASS::mvrnorm(20,c(0,1),diag(1,2)),a=2.5)
Computes the test statistic of the Henze-Visagie test.
HV(data, a = 5)HV(data, a = 5)
data |
a n x d numeric matrix of data values. |
a |
numeric number greater than 1 (tuning parameter). |
This functions evaluates the teststatistic with the given data and the specified tuning parameter a.
Each row of the data Matrix contains one of the n (multivariate) sample with dimension d. To ensure that the computation works properly
is needed. If that is not the case the function returns an error.
Note that a=Inf returns the limiting test statistic with value 2*MSkew + MRSSkew.
The value of the test statistic.
Henze, N., Visagie, J. (2019) "Testing for normality in any dimension based on a partial differential equation involving the moment generating function", Ann. Inst. Stat. Math., 72:1109–1136, doi:10.1007/s10463-019-00720-8
HV(MASS::mvrnorm(50,c(0,1),diag(1,2)),a=5) HV(MASS::mvrnorm(50,c(0,1),diag(1,2)),a=Inf)HV(MASS::mvrnorm(50,c(0,1),diag(1,2)),a=5) HV(MASS::mvrnorm(50,c(0,1),diag(1,2)),a=Inf)
This function returns the value of the statistic of the BHEP test as in Henze and Zirkler (1990). The difference to the BHEP test is in the choice of the tuning parameter .
HZ(data)HZ(data)
data |
a n x d matrix of d dimensional data vectors. |
A BHEP test is performed with tuning parameter chosen in dependence of the sample size n and the dimension d, namely
value of the test statistic.
Henze, N., and Zirkler, B. (1990), A class of invariant consistent tests for multivariate normality, Commun.-Statist. – Th. Meth., 19:3595–3617, doi:10.1080/03610929008830400
HZ(MASS::mvrnorm(50,c(0,1),diag(1,2)))HZ(MASS::mvrnorm(50,c(0,1),diag(1,2)))
This function computes the invariant measure of multivariate sample kurtosis due to Koziol (1989).
KKurt(data)KKurt(data)
data |
a n x d matrix of d dimensional data vectors. |
Multivariate sample kurtosis due to Koziol (1989) is defined by
where , , are the scaled residuals, is the sample mean and is the sample covariance matrix of the random vectors . To ensure that the computation works properly
is needed. If that is not the case the function returns an error. Note that for , we have a measure proportional to the squared sample kurtosis.
value of sample kurtosis in the sense of Koziol.
Koziol, J.A. (1989), A note on measures of multivariate kurtosis, Biom. J., 31:619–624.
KKurt(MASS::mvrnorm(50,c(0,1),diag(1,2)))KKurt(MASS::mvrnorm(50,c(0,1),diag(1,2)))
This function computes the invariant measure of multivariate sample kurtosis due to Malkovich and Afifi (1973).
MAKurt(data, Points = NULL)MAKurt(data, Points = NULL)
data |
a n x d matrix of d dimensional data vectors. |
Points |
points for approximation of the maximum on the sphere. |
Multivariate sample skewness due to Malkovich and Afifi (1973) is defined by
where is the sample mean and is the sample covariance matrix of the random vectors . To ensure that the computation works properly
is needed. If that is not the case the function returns an error.
value of sample kurtosis in the sense of Malkovich and Afifi.
Malkovich, J.F., and Afifi, A.A. (1973), On tests for multivariate normality, J. Amer. Statist. Ass., 68:176–179.
Henze, N. (2002), Invariant tests for multivariate normality: a critical review, Statistical Papers, 43:467–506.
MAKurt(MASS::mvrnorm(50,c(0,1),diag(1,2)))MAKurt(MASS::mvrnorm(50,c(0,1),diag(1,2)))
This function computes the invariant measure of multivariate sample skewness due to Malkovich and Afifi (1973).
MASkew(data, Points = NULL)MASkew(data, Points = NULL)
data |
a n x d matrix of d dimensional data vectors. |
Points |
points for approximation of the maximum on the sphere. |
Multivariate sample skewness due to Malkovich and Afifi (1973) is defined by
where is the sample mean and is the sample covariance matrix of the random vectors . To ensure that the computation works properly
is needed. If that is not the case the function returns an error.
value of sample skewness in the sense of Malkovich and Afifi.
Malkovich, J.F., and Afifi, A.A. (1973), On tests for multivariate normality, J. Amer. Statist. Ass., 68:176–179.
Henze, N. (2002), Invariant tests for multivariate normality: a critical review, Statistical Papers, 43:467–506.
MASkew(MASS::mvrnorm(50,c(0,1),diag(1,2)))MASkew(MASS::mvrnorm(50,c(0,1),diag(1,2)))
This function computes the classical invariant measure of multivariate sample kurtosis due to Mardia (1970).
MKurt(data)MKurt(data)
data |
a n x d matrix of d dimensional data vectors. |
Multivariate sample kurtosis due to Mardia (1970) is defined by
where , is the sample mean and is the sample covariance matrix of the random vectors .To ensure that the computation works properly
is needed. If that is not the case the function returns an error.
value of sample kurtosis in the sense of Mardia.
Mardia, K.V. (1970), Measures of multivariate skewness and kurtosis with applications, Biometrika, 57:519–530.
Henze, N. (2002), Invariant tests for multivariate normality: a critical review, Statistical Papers, 43:467–506.
MKurt(MASS::mvrnorm(50,c(0,1),diag(1,2)))MKurt(MASS::mvrnorm(50,c(0,1),diag(1,2)))
This function returns the value of the first statistic of Manzotti and Quiroz (2001).
MQ1(data)MQ1(data)
data |
a n x d matrix of d dimensional data vectors. |
Value of the test statistic
Manzotti, A., and Quiroz, A.J. (2001), Spherical harmonics in quadratic forms for testing multivariate normality, Test, 10:87–104, doi:10.1007/BF02595825
MQ1(MASS::mvrnorm(50,c(0,1),diag(1,2)))MQ1(MASS::mvrnorm(50,c(0,1),diag(1,2)))
This function returns the value of the second statistic of Manzotti und Quiroz (2001).
MQ2(data)MQ2(data)
data |
a n x d matrix of d dimensional data vectors. |
Value of the test statistic
Manzotti, A., and Quiroz, A.J. (2001), Spherical harmonics in quadratic forms for testing multivariate normality, Test, 10:87–104, doi:10.1007/BF02595825
MQ2(MASS::mvrnorm(50,c(0,1),diag(1,2)))MQ2(MASS::mvrnorm(50,c(0,1),diag(1,2)))
This function computes the invariant measure of multivariate sample skewness due to Móri, Rohatgi and Székely (1993).
MRSSkew(data)MRSSkew(data)
data |
a n x d matrix of d dimensional data vectors. |
Multivariate sample skewness due to Móri, Rohatgi and Székely (1993) is defined by
where , is the sample mean and is the sample covariance matrix of the random vectors . To ensure that the computation works properly
is needed. If that is not the case the function returns an error. Note that for , it is equivalent to skewness in the sense of Mardia.
value of sample skewness in the sense of Móri, Rohatgi and Székely.
Móri, T. F., Rohatgi, V. K., Székely, G. J. (1993), On multivariate skewness and kurtosis, Theory of Probability and its Applications, 38:547–551.
Henze, N. (2002), Invariant tests for multivariate normality: a critical review, Statistical Papers, 43:467–506.
This function computes the classical invariant measure of multivariate sample skewness due to Mardia (1970).
MSkew(data)MSkew(data)
data |
a n x d matrix of d dimensional data vectors. |
Multivariate sample skewness due to Mardia (1970) is defined by
where , is the sample mean and is the sample covariance matrix of the random vectors . To ensure that the computation works properly
is needed. If that is not the case the function returns an error. Note that for , we have a measure proportional to the squared sample skewness.
value of sample skewness in the sense of Mardia.
Mardia, K.V. (1970), Measures of multivariate skewness and kurtosis with applications, Biometrika, 57:519–530.
Henze, N. (2002), Invariant tests for multivariate normality: a critical review, Statistical Papers, 43:467–506.
MSkew(MASS::mvrnorm(50,c(0,1),diag(1,2)))MSkew(MASS::mvrnorm(50,c(0,1),diag(1,2)))
Printing objects of class "mnt".
## S3 method for class 'mnt' print(x, ...)## S3 method for class 'mnt' print(x, ...)
x |
object of class "mnt". |
... |
further arguments to be passed to or from methods. |
A mnt object is a named list of numbers and character string, supplemented with test (the name of the teststatistic). test is displayed as a title.
The remaining elements are given in an aligned "name = value" format.
the argument x, invisibly, as for all print methods.
print(test.DEHU(MASS::mvrnorm(50,c(0,1),diag(1,2)),a=1,MC=500))print(test.DEHU(MASS::mvrnorm(50,c(0,1),diag(1,2)),a=1,MC=500))
Approximates the test statistic of the Pudelko test.
PU(data, r = 2)PU(data, r = 2)
data |
a n x d numeric matrix of data values. |
r |
a positive number (radius of Ball) |
This functions evaluates the test statistic with the given data and the specified parameter r. Since since one has to calculate the supremum of a function inside a d-dimensional Ball of radius r. In this implementation the optim function is used.
approximate Value of the test statistic
Pudelko, J. (2005), On a new affine invariant and consistent test for multivariate normality, Probab. Math. Statist., 25:43–54.
PU(MASS::mvrnorm(20,c(0,1),diag(1,2)),r=2)PU(MASS::mvrnorm(20,c(0,1),diag(1,2)),r=2)
mnt
A dataset containing the empirical 0.9 quantiles of the tests for the dimensions d=2,3,5 and samplesizes n=20,50,100 based on a Monte Carlo Simulation study with 100000 repetitions. The following parameters were used:
For BHEP the parameter a=1,
for HV the parameter a=5,
for HJG the parameter a=1.5,
for HJM the parameter a=1.5,
for DEHT the parameter a=0.25,
for DEHU the parameter a=0.5,
for CS the parameter Points=NULL,
for PU the parameter r=2,
for MASkew the parameter Points=NULL,
for MAKurt the parameter Points=NULL,
Quantile09Quantile09
A data frame with 9 rows and 20 columns.
mnt
A dataset containing the empirical 0.95 quantiles of the tests for the dimensions d=2,3,5 and samplesizes n=20,50,100 based on a Monte Carlo Simulation study with 100000 repetitions. The following parameters were used:
For BHEP the parameter a=1,
for HV the parameter a=5,
for HJG the parameter a=1.5,
for HJM the parameter a=1.5,
for DEHT the parameter a=0.25,
for DEHU the parameter a=0.5,
for CS the parameter Points=NULL,
for PU the parameter r=2,
for MASkew the parameter Points=NULL,
for MAKurt the parameter Points=NULL,
Quantile095Quantile095
A data frame with 9 rows and 20 columns.
mnt
A dataset containing the empirical 0.99 quantiles of the tests for the dimensions d=2,3,5 and samplesizes n=20,50,100 based on a Monte Carlo Simulation study with 100000 repetitions. The following parameters were used:
For BHEP the parameter a=1,
for HV the parameter a=5,
for HJG the parameter a=1.5,
for HJM the parameter a=1.5,
for DEHT the parameter a=0.25,
for DEHU the parameter a=0.5,
for CS the parameter Points=NULL,
for PU the parameter r=2,
for MASkew the parameter Points=NULL,
for MAKurt the parameter Points=NULL,
Quantile099Quantile099
A data frame with 9 rows and 20 columns.
This function returns the value of the statistic of the test of multivariate normality (also called energy test) as in Székely and Rizzo (2005). Note that the scaled residuals use another scaling in the estimator of the covariance matrix as the other functions of the package mnt!
It is equivalent to the function mvnorm.e.
SR(data, abb = 1e-08)SR(data, abb = 1e-08)
data |
a n x d matrix of d dimensional data vectors. |
abb |
Stop criterium. |
value of the test statistic.
Székely, G., and Rizzo, M. (2005), A new test for multivariate normality, J. Multiv. Anal., 93:58–80, doi:10.1016/j.jmva.2003.12.002
SR(MASS::mvrnorm(50,c(0,1),diag(1,2)))SR(MASS::mvrnorm(50,c(0,1),diag(1,2)))
A function that computes the scaled residuals of the data.
standard(data)standard(data)
data |
a n x d matrix of d dimensional data vectors.. |
A n x d matrix of the scaled residuals.
Performs the BHEP test of multivariate normality of Henze and Wagner
(1997), with tuning parameter a. Critical values and p-values are obtained
by Monte Carlo simulation or by fitting a Pearson or Johnson distribution
to the first four moments of the limiting null distribution.
test.BHEP( data, a = 1, MC.rep = 10000, alpha = 0.05, cv.method = c("MC", "Pearson", "Johnson") )test.BHEP( data, a = 1, MC.rep = 10000, alpha = 0.05, cv.method = c("MC", "Pearson", "Johnson") )
data |
A numeric |
a |
Positive, finite tuning parameter; corresponds to |
MC.rep |
Positive integer giving the number of Monte Carlo
replications. Used only when |
alpha |
Significance level, strictly between zero and one. |
cv.method |
Method used to approximate the critical value:
|
The test statistic is
Here ,
, and
.
With cv.method = "MC", cv.quan simulates the null
distribution at the observed sample size and dimension ,
using MC.rep replications. The same simulated statistics are used for the critical value and the
Monte Carlo p-value
where is MC.rep. The critical value retains
the order-statistic convention of cv.quan, and Decision
remains Test.value > cv. Because the Monte Carlo p-value is discrete
and uses the plus-one correction, this decision can differ from
pvalue <= alpha near the cutoff.
With cv.method = "Pearson" or "Johnson", the critical
value is obtained from a moment-based approximation to the limiting null
distribution . Let denote its cumulants.
The first three cumulants are given by Henze and Wagner (1997), and the
fourth by Theorem 3.2 and Appendix A of Ebner and Henze's announced
manuscript. The mean, variance, skewness and ordinary kurtosis are
In particular, the fourth central moment is
; it is not the fourth cumulant.
An object of class "mnt", with components:
TestName of the test.
paramValue of the tuning parameter.
Test.valueValue of the test statistic.
cvApproximated upper critical value.
DecisionTRUE if Test.value > cv, so the
null hypothesis is rejected at the chosen significance level.
cv.methodCritical-value method actually used.
pvalueUpper-tail p-value computed using the selected method. The Pearson and Johnson p-values are asymptotic approximations.
Henze, N. and Wagner, T. (1997). A new approach to the BHEP tests for multivariate normality. Journal of Multivariate Analysis, 62, 1–23. doi:10.1006/jmva.1997.1684.
Ebner, B. and Henze, N. Four-Moment Approximations and Fast p-Values for BHEP Tests of Multivariate Normality. Supplied manuscript ‘BHEP_fourth_moment.pdf’, Theorem 3.2 and Appendix A.
set.seed(123) x <- matrix(rnorm(100), ncol = 2) test.BHEP(x, MC.rep = 500) if (requireNamespace("PearsonDS", quietly = TRUE)) { test.BHEP(x, cv.method = "Pearson") } if (requireNamespace("SuppDists", quietly = TRUE)) { test.BHEP(x, cv.method = "Johnson") }set.seed(123) x <- matrix(rnorm(100), ncol = 2) test.BHEP(x, MC.rep = 500) if (requireNamespace("PearsonDS", quietly = TRUE)) { test.BHEP(x, cv.method = "Pearson") } if (requireNamespace("SuppDists", quietly = TRUE)) { test.BHEP(x, cv.method = "Johnson") }
Performs the test of multivariate normality of Cox and Small (1978).
test.CS(data, MC.rep = 1000, alpha = 0.05, Points = NULL)test.CS(data, MC.rep = 1000, alpha = 0.05, Points = NULL)
data |
a n x d matrix of d dimensional data vectors. |
MC.rep |
number of repetitions for the Monte Carlo simulation of the critical value. |
alpha |
level of significance of the test. |
Points |
number of points to approximate the maximum functional on the unit sphere. |
The test statistic is ,
where
.
Here, , , are the scaled residuals, is the sample mean and is the sample covariance matrix of the random vectors . To ensure that the computation works properly
is needed. If that is not the case the test returns an error. Note that the maximum functional has to be approximated by a discrete version, for details see Ebner (2012).
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha:
$Testname of the test.
$Test.valuethe value of the test statistic.
$cvthe approximated critical value.
$Decisionthe comparison of the critical value and the value of the test statistic.
#'
Cox, D.R., Small, N.J.H. (1978), Testing multivariate normality, Biometrika, 65:263-272.
Ebner, B. (2012), Asymptotic theory for the test for multivariate normality by Cox and Small, Journal of Multivariate Analysis, 111:368-379.
test.CS(MASS::mvrnorm(10,c(0,1),diag(1,2)),MC.rep=100)test.CS(MASS::mvrnorm(10,c(0,1),diag(1,2)),MC.rep=100)
Computes the multivariate normality test of Doerr, Ebner and Henze (2019) based on zeros of the harmonic oscillator.
test.DEHT(data, a = 1, MC.rep = 10000, alpha = 0.05)test.DEHT(data, a = 1, MC.rep = 10000, alpha = 0.05)
data |
a n x d matrix of d dimensional data vectors. |
a |
positive numeric number (tuning parameter). |
MC.rep |
number of repetitions for the Monte Carlo simulation of the critical value. |
alpha |
level of significance of the test. |
This functions evaluates the teststatistic with the given data and the specified tuning parameter a.
Each row of the data Matrix contains one of the n (multivariate) sample with dimension d. To ensure that the computation works properly
is needed. If that is not the case the test returns an error.
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha:
$Testname of the test.
$paramvalue tuning parameter.
$Test.valuethe value of the test statistic.
$cvthe approximated critical value.
$Decisionthe comparison of the critical value and the value of the test statistic.
Doerr, P., Ebner, B., Henze, N. (2019) "Testing multivariate normality by zeros of the harmonic oscillator in characteristic function spaces" arXiv:1909.12624
test.DEHT(MASS::mvrnorm(20,c(0,1),diag(1,2)),a=1,MC=500)test.DEHT(MASS::mvrnorm(20,c(0,1),diag(1,2)),a=1,MC=500)
Computes the multivariate normality test of Doerr, Ebner and Henze (2019) based on a double estimation in a PDE.
test.DEHU(data, a = 0.5, MC.rep = 10000, alpha = 0.05)test.DEHU(data, a = 0.5, MC.rep = 10000, alpha = 0.05)
data |
a n x d matrix of d dimensional data vectors. |
a |
positive numeric number (tuning parameter). |
MC.rep |
number of repetitions for the Monte Carlo simulation of the critical value. |
alpha |
level of significance of the test. |
This functions evaluates the teststatistic with the given data and the specified tuning parameter a.
Each row of the data Matrix contains one of the n (multivariate) sample with dimension d. To ensure that the computation works properly
is needed. If that is not the case the test returns an error.
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha:
$Testname of the test.
$paramvalue tuning parameter.
$Test.valuethe value of the test statistic.
$cvthe approximated critical value.
$Decisionthe comparison of the critical value and the value of the test statistic.
Doerr, P., Ebner, B., Henze, N. (2019) "Testing multivariate normality by zeros of the harmonic oscillator in characteristic function spaces" arXiv:1909.12624
test.DEHU(MASS::mvrnorm(50,c(0,1),diag(1,2)),a=1,MC=500)test.DEHU(MASS::mvrnorm(50,c(0,1),diag(1,2)),a=1,MC=500)
Computes the multivariate normality test of Ebner, Henze and Strieder (2020) based on Fourier methods in a multivariate Stein equation.
test.EHS(data, a = 0.5, MC.rep = 10000, alpha = 0.05)test.EHS(data, a = 0.5, MC.rep = 10000, alpha = 0.05)
data |
a n x d matrix of d dimensional data vectors. |
a |
positive numeric number (tuning parameter). |
MC.rep |
number of repetitions for the Monte Carlo simulation of the critical value. |
alpha |
level of significance of the test. |
This functions evaluates the teststatistic with the given data and the specified tuning parameter a.
Each row of the data Matrix contains one of the n (multivariate) sample with dimension d. To ensure that the computation works properly
is needed. If that is not the case the test returns an error.
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha:
$Testname of the test.
$paramvalue tuning parameter.
$Test.valuethe value of the test statistic.
$cvthe approximated critical value.
$Decisionthe comparison of the critical value and the value of the test statistic.
Ebner, B., Henze, N., Strieder, D. (2020) "Testing normality in any dimension by Fourier methods in a multivariate Stein equation" arXiv:2007.02596
test.EHS(MASS::mvrnorm(50,c(0,1),diag(1,2)),a=1,MC=500)test.EHS(MASS::mvrnorm(50,c(0,1),diag(1,2)),a=1,MC=500)
Computes the multivariate normality test of Henze and Jimenes-Gamero (2019) in dependence of a tuning parameter a.
test.HJG(data, a = 1, MC.rep = 10000, alpha = 0.05)test.HJG(data, a = 1, MC.rep = 10000, alpha = 0.05)
data |
a n x d matrix of d dimensional data vectors. |
a |
positive numeric number (tuning parameter). |
MC.rep |
number of repetitions for the Monte Carlo simulation of the critical value. |
alpha |
level of significance of the test. |
This functions evaluates the teststatistic with the given data and the specified tuning parameter a.
Each row of the data Matrix contains one of the n (multivariate) sample with dimension d. To ensure that the computation works properly
is needed. If that is not the case the test returns an error.
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha:
$Testname of the test.
$paramvalue tuning parameter.
$Test.valuethe value of the test statistic.
$cvthe approximated critical value.
$Decisionthe comparison of the critical value and the value of the test statistic.
#'
Henze, N., Jimenez-Gamero, M.D. (2019) "A new class of tests for multinormality with i.i.d. and garch data based on the empirical moment generating function", TEST, 28, 499-521, doi:10.1007/s11749-018-0589-z
test.HJG(MASS::mvrnorm(50,c(0,1),diag(1,2)),a=1.5,MC.rep=500)test.HJG(MASS::mvrnorm(50,c(0,1),diag(1,2)),a=1.5,MC.rep=500)
Computes the test statistic of the Henze-Jimenes-Gamero-Meintanis test.
test.HJM(data, a = 1.5, MC.rep = 500, alpha = 0.05)test.HJM(data, a = 1.5, MC.rep = 500, alpha = 0.05)
data |
a n x d matrix of d dimensional data vectors. |
a |
positive numeric number (tuning parameter). |
MC.rep |
number of repetitions for the Monte Carlo simulation of the critical value. |
alpha |
level of significance of the test. |
This functions evaluates the teststatistic with the given data and the specified tuning parameter a.
Each row of the data Matrix contains one of the n (multivariate) sample with dimension d. To ensure that the computation works properly
is needed. If that is not the case the test returns an error.
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha:
$Testname of the test.
$paramvalue tuning parameter.
$Test.valuethe value of the test statistic.
$cvthe approximated critical value.
$Decisionthe comparison of the critical value and the value of the test statistic.
Henze, N., Jimenes-Gamero, M.D., Meintanis, S.G. (2019), Characterizations of multinormality and corresponding tests of fit, including for GARCH models, Econometric Th., 35:510-546, doi:10.1017/S0266466618000154.
test.HJM(MASS::mvrnorm(10,c(0,1),diag(1,2)),a=2.5,MC=100)test.HJM(MASS::mvrnorm(10,c(0,1),diag(1,2)),a=2.5,MC=100)
Computes the multivariate normality test of Henze and Visagie (2019).
test.HV(data, a = 5, MC.rep = 10000, alpha = 0.05)test.HV(data, a = 5, MC.rep = 10000, alpha = 0.05)
data |
a n x d matrix of d dimensional data vectors. |
a |
positive numeric number (tuning parameter). |
MC.rep |
number of repetitions for the Monte Carlo simulation of the critical value. |
alpha |
level of significance of the test. |
This functions evaluates the teststatistic with the given data and the specified tuning parameter a.
Each row of the data Matrix contains one of the n (multivariate) sample with dimension d. To ensure that the computation works properly
is needed. If that is not the case the test returns an error.
Note that a=Inf returns the limiting test statistic with value 2*MSkew + MRSSkew.
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha:
$Testname of the test.
$paramvalue tuning parameter.
$Test.valuethe value of the test statistic.
$cvthe approximated critical value.
$Decisionthe comparison of the critical value and the value of the test statistic.
Henze, N., Visagie, J. (2019) "Testing for normality in any dimension based on a partial differential equation involving the moment generating function", to appear in Ann. Inst. Stat. Math., doi:10.1007/s10463-019-00720-8
test.HV(MASS::mvrnorm(50,c(0,1),diag(1,2)),a=5,MC.rep=500) test.HV(MASS::mvrnorm(50,c(0,1),diag(1,2)),a=Inf,MC.rep=500)test.HV(MASS::mvrnorm(50,c(0,1),diag(1,2)),a=5,MC.rep=500) test.HV(MASS::mvrnorm(50,c(0,1),diag(1,2)),a=Inf,MC.rep=500)
Performs the test of multivariate normality of Henze and Zirkler (1990).
test.HZ(data, MC.rep = 10000, alpha = 0.05)test.HZ(data, MC.rep = 10000, alpha = 0.05)
data |
a n x d matrix of d dimensional data vectors. |
MC.rep |
number of repetitions for the Monte Carlo simulation of the critical value |
alpha |
level of significance of the test |
A BHEP test is performed with tuning parameter chosen in dependence of the sample size n and the dimension d, namely
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha:
$Testname of the test.
$paramvalue tuning parameter.
$Test.valuethe value of the test statistic.
$cvthe approximated critical value.
$Decisionthe comparison of the critical value and the value of the test statistic.
#'
Henze, N., Zirkler, B. (1990), A class of invariant consistent tests for multivariate normality, Commun.-Statist. - Th. Meth., 19:3595-3617, doi:10.1080/03610929008830400
test.HZ(MASS::mvrnorm(50,c(0,1),diag(1,2)),MC.rep=500)test.HZ(MASS::mvrnorm(50,c(0,1),diag(1,2)),MC.rep=500)
Computes the multivariate normality test based on the invariant measure of multivariate sample kurtosis due to Koziol (1989).
test.KKurt(data, MC.rep = 10000, alpha = 0.05)test.KKurt(data, MC.rep = 10000, alpha = 0.05)
data |
a n x d matrix of d dimensional data vectors. |
MC.rep |
number of repetitions for the Monte Carlo simulation of the critical value |
alpha |
level of significance of the test |
Multivariate sample kurtosis due to Koziol (1989) is defined by
where , , are the scaled residuals, is the sample mean and is the sample covariance matrix of the random vectors . To ensure that the computation works properly
is needed. If that is not the case the test returns an error. Note that for , we have a measure proportional to the squared sample kurtosis.
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha:
$Testname of the test.
$Test.valuethe value of the test statistic.
$cvthe approximated critical value.
$Decisionthe comparison of the critical value and the value of the test statistic.
Koziol, J.A. (1989), A note on measures of multivariate kurtosis, Biom. J., 31:619-624.
test.KKurt(MASS::mvrnorm(50,c(0,1),diag(1,2)),MC.rep=500)test.KKurt(MASS::mvrnorm(50,c(0,1),diag(1,2)),MC.rep=500)
Computes the multivariate normality test based on the invariant measure of multivariate sample kurtosis due to Malkovich and Afifi (1973).
test.MAKurt(data, MC.rep = 10000, alpha = 0.05, num.points = 1000)test.MAKurt(data, MC.rep = 10000, alpha = 0.05, num.points = 1000)
data |
a n x d matrix of d dimensional data vectors. |
MC.rep |
number of repetitions for the Monte Carlo simulation of the critical value |
alpha |
level of significance of the test |
num.points |
number of points distributed uniformly over the sphere for approximation of the maximum on the sphere. |
Multivariate sample skewness due to Malkovich and Afifi (1973) is defined by
where is the sample mean and is the sample covariance matrix of the random vectors . To ensure that the computation works properly
is needed. If that is not the case the test returns an error.
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha:
$Testname of the test.
$paramnumber of points used in approximation.
$Test.valuethe value of the test statistic.
$cvthe approximated critical value.
$Decisionthe comparison of the critical value and the value of the test statistic.
Malkovich, J.F., and Afifi, A.A. (1973), On tests for multivariate normality, J. Amer. Statist. Ass., 68:176-179.
Henze, N. (2002), Invariant tests for multivariate normality: a critical review, Statistical Papers, 43:467-506.
test.MAKurt(MASS::mvrnorm(10,c(0,1),diag(1,2)),MC.rep=100)test.MAKurt(MASS::mvrnorm(10,c(0,1),diag(1,2)),MC.rep=100)
Computes the test of multivariate normality based on skewness in the sense of Malkovich and Afifi (1973).
test.MASkew(data, MC.rep = 10000, alpha = 0.05, num.points = 1000)test.MASkew(data, MC.rep = 10000, alpha = 0.05, num.points = 1000)
data |
a n x d matrix of d dimensional data vectors. |
MC.rep |
number of repetitions for the Monte Carlo simulation of the critical value |
alpha |
level of significance of the test |
num.points |
number of points distributed uniformly over the sphere for approximation of the maximum on the sphere. |
Multivariate sample skewness due to Malkovich and Afifi (1973) is defined by
where is the sample mean and is the sample covariance matrix of the random vectors . To ensure that the computation works properly
is needed. If that is not the case the test returns an error.
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha:
$Testname of the test.
$paramnumber of points used in approximation.
$Test.valuethe value of the test statistic.
$cvthe approximated critical value.
$Decisionthe comparison of the critical value and the value of the test statistic.
Malkovich, J.F., and Afifi, A.A. (1973), On tests for multivariate normality, J. Amer. Statist. Ass., 68:176-179.
Henze, N. (2002), Invariant tests for multivariate normality: a critical review, Statistical Papers, 43:467-506.
test.MASkew(MASS::mvrnorm(10,c(0,1),diag(1,2)),MC.rep=100)test.MASkew(MASS::mvrnorm(10,c(0,1),diag(1,2)),MC.rep=100)
Computes the multivariate normality test based on the classical invariant measure of multivariate sample kurtosis due to Mardia (1970).
test.MKurt(data, MC.rep = 10000, alpha = 0.05)test.MKurt(data, MC.rep = 10000, alpha = 0.05)
data |
a n x d matrix of d dimensional data vectors. |
MC.rep |
number of repetitions for the Monte Carlo simulation of the critical value |
alpha |
level of significance of the test |
Multivariate sample kurtosis due to Mardia (1970) is defined by
where , is the sample mean and is the sample covariance matrix of the random vectors .To ensure that the computation works properly
is needed. If that is not the case the test returns an error.
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha:
$Testname of the test.
$Test.valuethe value of the test statistic.
$cvthe approximated critical value.
$Decisionthe comparison of the critical value and the value of the test statistic.
Mardia, K.V. (1970), Measures of multivariate skewness and kurtosis with applications, Biometrika, 57:519-530.
Henze, N. (2002), Invariant tests for multivariate normality: a critical review, Statistical Papers, 43:467-506.
test.MKurt(MASS::mvrnorm(50,c(0,1),diag(1,2)),MC.rep=500)test.MKurt(MASS::mvrnorm(50,c(0,1),diag(1,2)),MC.rep=500)
Performs the first test of multivariate normality of Manzotti and Quiroz (2001).
test.MQ1(data, MC.rep = 10000, alpha = 0.05)test.MQ1(data, MC.rep = 10000, alpha = 0.05)
data |
a n x d matrix of d dimensional data vectors. |
MC.rep |
number of repetitions for the Monte Carlo simulation of the critical value |
alpha |
level of significance of the test |
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha:
$Testname of the test.
$paramvalue tuning parameter.
$Test.valuethe value of the test statistic.
$cvthe approximated critical value.
$Decisionthe comparison of the critical value and the value of the test statistic.
#'
Manzotti, A., Quiroz, A.J. (2001), Spherical harmonics in quadratic forms for testing multivariate normality, Test, 10:87-104, doi:10.1007/BF02595825
test.MQ1(MASS::mvrnorm(50,c(0,1),diag(1,2)),MC.rep=100)test.MQ1(MASS::mvrnorm(50,c(0,1),diag(1,2)),MC.rep=100)
Performs the second test of multivariate normality of Manzotti and Quiroz (2001).
test.MQ2(data, MC.rep = 10000, alpha = 0.05)test.MQ2(data, MC.rep = 10000, alpha = 0.05)
data |
a n x d matrix of d dimensional data vectors. |
MC.rep |
number of repetitions for the Monte Carlo simulation of the critical value |
alpha |
level of significance of the test |
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha:
$Testname of the test.
$Test.valuethe value of the test statistic.
$cvthe approximated critical value.
$Decisionthe comparison of the critical value and the value of the test statistic.
#'
Manzotti, A., Quiroz, A.J. (2001), Spherical harmonics in quadratic forms for testing multivariate normality, Test, 10:87-104, doi:10.1007/BF02595825
test.MQ2(MASS::mvrnorm(50,c(0,1),diag(1,2)),MC.rep=500)test.MQ2(MASS::mvrnorm(50,c(0,1),diag(1,2)),MC.rep=500)
Computes the multivariate normality test based on the invariant measure of multivariate sample skewness due to Mori, Rohatgi and Szekely (1993).
test.MRSSkew(data, MC.rep = 10000, alpha = 0.05)test.MRSSkew(data, MC.rep = 10000, alpha = 0.05)
data |
a n x d matrix of d dimensional data vectors. |
MC.rep |
number of repetitions for the Monte Carlo simulation of the critical value |
alpha |
level of significance of the test |
Multivariate sample skewness due to Mori, Rohatgi and Szekely (1993) is defined by
where , is the sample mean and is the sample covariance matrix of the random vectors . To ensure that the computation works properly
is needed. If that is not the case the test returns an error. Note that for , it is equivalent to skewness in the sense of Mardia.
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha:
$Testname of the test.
$Test.valuethe value of the test statistic.
$cvthe approximated critical value.
$Decisionthe comparison of the critical value and the value of the test statistic.
Mori, T. F., Rohatgi, V. K., Szekely, G. J. (1993), On multivariate skewness and kurtosis, Theory of Probability and its Applications, 38:547-551.
Henze, N. (2002), Invariant tests for multivariate normality: a critical review, Statistical Papers, 43:467-506.
test.MRSSkew(MASS::mvrnorm(50,c(0,1),diag(1,2)),MC.rep=500)test.MRSSkew(MASS::mvrnorm(50,c(0,1),diag(1,2)),MC.rep=500)
Computes the multivariate normality test based on the classical invariant measure of multivariate sample skewness due to Mardia (1970).
test.MSkew(data, MC.rep = 10000, alpha = 0.05)test.MSkew(data, MC.rep = 10000, alpha = 0.05)
data |
a n x d matrix of d dimensional data vectors. |
MC.rep |
number of repetitions for the Monte Carlo simulation of the critical value |
alpha |
level of significance of the test |
Multivariate sample skewness due to Mardia (1970) is defined by
where , is the sample mean and is the sample covariance matrix of the random vectors . To ensure that the computation works properly
is needed. If that is not the case the test returns an error. Note that for , we have a measure proportional to the squared sample skewness.
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha:
$Testname of the test.
$Test.valuethe value of the test statistic.
$cvthe approximated critical value.
$Decisionthe comparison of the critical value and the value of the test statistic.
Mardia, K.V. (1970), Measures of multivariate skewness and kurtosis with applications, Biometrika, 57:519-530.
Henze, N. (2002), Invariant tests for multivariate normality: a critical review, Statistical Papers, 43:467-506.
test.MSkew(MASS::mvrnorm(50,c(0,1),diag(1,2)),MC.rep=500)test.MSkew(MASS::mvrnorm(50,c(0,1),diag(1,2)),MC.rep=500)
Computes the (approximated) Pudelko test of multivariate normality.
test.PU(data, MC.rep = 10000, alpha = 0.05, r = 2)test.PU(data, MC.rep = 10000, alpha = 0.05, r = 2)
data |
a n x d matrix of d dimensional data vectors. |
MC.rep |
number of repetitions for the Monte Carlo simulation of the critical value. |
alpha |
level of significance of the test. |
r |
a positive number (radius of Ball) |
This functions evaluates the test statistic with the given data and the specified parameter r. Since since one has to calculate the supremum of a function inside a d-dimensional Ball of radius r. In this implementation the optim function is used.
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha:
$Testname of the test.
$paramvalue tuning parameter.
$Test.valuethe value of the test statistic.
$cvthe approximated critical value.
$Decisionthe comparison of the critical value and the value of the test statistic.
Pudelko, J. (2005), On a new affine invariant and consistent test for multivariate normality, Probab. Math. Statist., 25:43-54.
test.PU(MASS::mvrnorm(20,c(0,1),diag(1,2)),r=2,MC=100)test.PU(MASS::mvrnorm(20,c(0,1),diag(1,2)),r=2,MC=100)
Performs the test of multivariate normality of Szekely and Rizzo (2005). Note that the scaled residuals use another scaling in the estimator of the covariance matrix!
test.SR(data, MC.rep = 10000, alpha = 0.05, abb = 1e-08)test.SR(data, MC.rep = 10000, alpha = 0.05, abb = 1e-08)
data |
a n x d matrix of d dimensional data vectors. |
MC.rep |
number of repetitions for the Monte Carlo simulation of the critical value |
alpha |
level of significance of the test |
abb |
Stop criterium. |
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha:
$Testname of the test.
$Test.valuethe value of the test statistic.
$cvthe approximated critical value.
$Decisionthe comparison of the critical value and the value of the test statistic.
#'
Szekely, G., Rizzo, M. (2005), A new test for multivariate normality, J. Multiv. Anal., 93:58-80, doi:10.1016/j.jmva.2003.12.002
test.SR(MASS::mvrnorm(50,c(0,1),diag(1,2)),MC.rep=500)test.SR(MASS::mvrnorm(50,c(0,1),diag(1,2)),MC.rep=500)