MardiaCombinedTest[data]
tests whether data follows a MultinormalDistribution using the Mardia combined test.
MardiaCombinedTest[data,"property"]
returns the value of "property".
MardiaCombinedTest
MardiaCombinedTest[data]
tests whether data follows a MultinormalDistribution using the Mardia combined test.
MardiaCombinedTest[data,"property"]
returns the value of "property".
Details and Options
- MardiaCombinedTest performs a goodness-of-fit test with null hypothesis
that data was drawn from a MultinormalDistribution and alternative hypothesis
that it was not. - By default, a probability value or
-value is returned. - A small
-value suggests that it is unlikely that the data is normally distributed. - The data can be univariate {x1,x2,…} or multivariate {{x1,y1,…},{x2,y2,…},…}.
- The Mardia combined test effectively pools the results from MardiaSkewnessTest and MardiaKurtosisTest.
- MardiaCombinedTest[data,dist,"HypothesisTestData"] returns a HypothesisTestData object htd that can be used to extract additional test results and properties using the form htd["property"].
- MardiaCombinedTest[data,dist,"property"] can be used to directly give the value of "property".
- Properties related to the reporting of test results include:
-
"DegreesOfFreedom" the degrees of freedom used in a test "PValue"
-value"PValueTable" formatted version of "PValue" "ShortTestConclusion" a short description of the conclusion of a test "TestConclusion" a description of the conclusion of a test "TestData" test statistic and
-value"TestDataTable" formatted version of "TestData" "TestStatistic" test statistic "TestStatisticTable" formatted "TestStatistic" - The following properties are independent of which test is being performed.
- Properties related to the data distribution include:
-
"FittedDistribution" fitted distribution of data "FittedDistributionParameters" distribution parameters of data - The following options can be given:
-
Method Automatic the method to use for computing
-valuesSignificanceLevel 0.05 cutoff for diagnostics and reporting - For a test for goodness of fit, a cutoff
is chosen such that
is rejected only if
. The value of
used for the "TestConclusion" and "ShortTestConclusion" properties is controlled by the SignificanceLevel option. By default,
is set to 0.05. - With the setting Method->"MonteCarlo",
datasets of the same length as the input
are generated under
using the fitted distribution. The EmpiricalDistribution from MardiaCombinedTest[si,"TestStatistic"] is then used to estimate the
-value.
Examples
open all close allBasic Examples (3)
Perform a test for multivariate normality:
data = RandomVariate[MultinormalDistribution[{1, 2, 3}, IdentityMatrix[3]], 1000];htd = MardiaCombinedTest[data, "HypothesisTestData"]htd[Automatic]Extract the test statistic from the Mardia combined test:
data = RandomVariate[MultinormalDistribution[{1, 2, 3}, IdentityMatrix[3]], 1000];MardiaCombinedTest[data, "TestStatistic"]Obtain a formatted test table:
data = RandomVariate[MultinormalDistribution[{0, 0, 0}, IdentityMatrix[3]], 1000];MardiaCombinedTest[data, "TestDataTable"]Scope (5)
Testing (2)
Perform a Mardia test for multivariate normality:
data1 = RandomVariate[MultinormalDistribution[{1, 2, 3}, IdentityMatrix[3]], 1000];
data2 = RandomVariate[MultivariateTDistribution[IdentityMatrix[2], 3], 1000];The
-value for the normal data is large compared to the
-value for the non-normal data:
MardiaCombinedTest[data1]MardiaCombinedTest[data2]Create a HypothesisTestData object for repeated property extraction:
data = RandomVariate[BinormalDistribution[.5], 10^5];ℋ = MardiaCombinedTest[data, "HypothesisTestData"]The properties available for extraction:
ℋ["Properties"]Reporting (3)
Tabulate the results of the Mardia combined test:
data = RandomVariate[BinormalDistribution[.5], 10^3];ℋ = MardiaCombinedTest[data, "HypothesisTestData"];ℋ["TestDataTable"]ℋ["PValueTable"]ℋ["TestStatisticTable"]Retrieve the entries from a Mardia combined test table for custom reporting:
data1 = RandomVariate[BinormalDistribution[.5], 10^4];
data2 = RandomVariate[BinormalDistribution[.5], 10^3];ℋ1 = MardiaCombinedTest[data1, "TestData"]ℋ2 = MardiaCombinedTest[data2, "TestData"]BarChart[{Labeled[ℋ1, "Set 1"], Labeled[ℋ2, "Set 2"]}, ChartLabels -> {"SubscriptBox[M, S]", "p‐value"}]Report test conclusions using "ShortTestConclusion" and "TestConclusion":
data = BlockRandom[SeedRandom[1];RandomVariate[StudentTDistribution[4], {100, 2}]];ℋ = MardiaCombinedTest[data, "HypothesisTestData"];ℋ["ShortTestConclusion"]ℋ["TestConclusion"]//TraditionalFormThe conclusion may differ at a different significance level:
ℋ = MardiaCombinedTest[data, "HypothesisTestData", SignificanceLevel -> .001];ℋ["ShortTestConclusion"]ℋ["TestConclusion"]//TraditionalFormOptions (4)
Method (3)
Use Monte Carlo-based methods or a computation formula:
data = RandomVariate[BinormalDistribution[.5], 100];MardiaCombinedTest[data, Method -> "MonteCarlo"]MardiaCombinedTest[data, Method -> Automatic]Set the number of samples to use for Monte Carlo-based methods:
data = RandomVariate[BinormalDistribution[.5], 500];pts = Table[{i, MardiaCombinedTest[data, Method -> {"MonteCarlo", "MonteCarloSamples" -> i}]}, {i, Range[5, 1000, 150]}];The Monte Carlo estimate converges to the true
-value with increasing samples:
pval = MardiaCombinedTest[data];Show[ListLinePlot[pts, PlotRange -> {0, 1}, FrameLabel -> {"Samples", "P-Value"}, Frame -> True, AxesOrigin -> {0, 0}], Graphics[{Dashed, Line[{{0, pval}, {1000, pval}}]}]]Set the random seed used in Monte Carlo-based methods:
data = RandomVariate[BinormalDistribution[.5], 500];pts = Table[{i, MardiaCombinedTest[data, Method -> {"MonteCarlo", "MonteCarloSamples" -> 100, "RandomSeed" -> i}]}, {i, Range[1, 10]}];The seed affects the state of the generator and has some effect on the resulting
-value:
pval = MardiaCombinedTest[data];Show[ListLinePlot[pts, PlotRange -> {Min[pts[[All, 2]]], Max[pts[[All, 2]]]}, FrameLabel -> {"Seed", "P-Value"}, Frame -> True, AxesOrigin -> {0, 0}], Graphics[{Dashed, Line[{{0, pval}, {100, pval}}]}]]SignificanceLevel (1)
Set the significance level used for "TestConclusion" and "ShortTestConclusion":
data = BlockRandom[SeedRandom[1];RandomVariate[StudentTDistribution[5], {100, 2}]];MardiaCombinedTest[data, "ShortTestConclusion", SignificanceLevel -> .1]MardiaCombinedTest[data, "ShortTestConclusion", SignificanceLevel -> .25]MardiaCombinedTest[data, "TestConclusion"]//TraditionalFormApplications (2)
A power curve for the Mardia combined test:
data = Table[RandomVariate[MultivariateTDistribution[IdentityMatrix[2], 3], {500, i}], {i, n = {10, 15, 20, 25, 30}}];ℋ = Table[MardiaCombinedTest[data[[i, j]]], {i, Length[data]}, {j, Length[data[[i]]]}];pC = Interpolation[Transpose[{n, Table[Probability[x ≤ 0.05, xi], {i, ℋ}]}], InterpolationOrder -> 1];Visualize the approximate power curve:
Plot[pC[x], {x, 10, 30}, PlotRange -> {0, 1}, Ticks -> {n, Automatic}, AxesOrigin -> {7, 0}]Estimate the power of the Mardia combined test when the underlying distribution is a MultivariateTDistribution, the test size is 0.05, and the sample size is 12:
pC[12.]Five morphological measures were recorded for two separate varieties of a crab species. A researcher hopes to simultaneously compare all the measures across the species using multivariate analysis of variance, which requires that the data is multivariate normal:
data = ExampleData[{"Statistics", "CrabMeasures"}];ExampleData[{"Statistics", "CrabMeasures"}, "ColumnDescriptions"]var = data[[All, 1]];Use MardiaCombinedTest to determine if both sets of data are multivariate normal:
MardiaCombinedTest[d1 = Pick[data[[All, -5 ;; -1]], var, "B"], "TestDataTable"]MardiaCombinedTest[d2 = Pick[data[[All, -5 ;; -1]], var, "O"], "TestDataTable"]Univariate density estimates of the five measures for each species:
measures = {"frontal lobe size", "rear width", "carapace length", "carapace width", "body depth"};{SmoothHistogram[Transpose@d1, PlotRange -> (r = {0, .16}), ImageSize -> (s = 180), PlotLabel -> "Blue crab"], SmoothHistogram[Transpose@d2, PlotRange -> r, ImageSize -> s, PlotLabel -> "Orange crab", PlotLegends -> measures]}The deviation from normality appears to be in the skewness:
MardiaKurtosisTest[#, "ShortTestConclusion"]& /@ {d1, d2}MardiaSkewnessTest[#, "ShortTestConclusion"]& /@ {d1, d2}Properties & Relations (3)
The multivariate test statistic:
data = RandomVariate[BinormalDistribution[.5], 100];MCombined[data_] := With[{p = Dimensions[data][[2]], n = Length[data]},
((1 + n) (3 + n) (1 + p)/n (-5 + n + p + n p))MardiaSkewnessTest[data, "TestStatistic"] + MardiaKurtosisTest[data, "TestStatistic"] ^ 2]MCombined[data]MardiaCombinedTest[data, "TestStatistic"]Under
, the test statistic asymptotically follows a ChiSquareDistribution:
data = RandomVariate[BinormalDistribution[.5], {1000, 250}];t = MCombined /@ data;With[{dim = 2, n = 100}, DistributionFitTest[t, ChiSquareDistribution[(1/6) dim (dim + 1) (dim + 2) + 1]]]For univariate data, the test is equivalent to the JarqueBeraALMTest:
data = RandomVariate[NormalDistribution[], 100];JarqueBeraALMTest[data, "TestDataTable"]MardiaCombinedTest[data, "TestDataTable"]The Mardia combined test works with the values only when the input is a TimeSeries:
ts = TemporalData[TimeSeries, {{{{-0.49926617600557877, -0.9693358407186422, 0.5958383000077166},
{-1.33047395864177, -0.8677417392521979, -0.07701839279253664},
{-0.0007329523045247477, 0.3732688420773089, 0.4231608535246955},
{-0.628458 ... 1802556, -0.646006722738045, 0.22111034631867293},
{0.5843977994899021, 0.20194372201917066, 0.04486228650659786}}}, {{0, 100, 1}}, 1,
{"Continuous", 1}, {"Discrete", 1}, 3, {ValueDimensions -> 3, ResamplingMethod -> None}}, False,
10.1];ts["ValueDimensions"]MardiaCombinedTest[ts]MardiaCombinedTest[ts["Values"]]Possible Issues (1)
If the covariance matrix of the data is not positive definite, the test will fail:
data = {{37, 67, 72, 25}, {39, 27, 22, 51}, {63, 71, 59, 2}};PositiveDefiniteMatrixQ@Covariance[data]MardiaCombinedTest[data]The number of data points must be greater than the dimension of the data:
Tally@Table[PositiveDefiniteMatrixQ[Covariance[RandomVariate[NormalDistribution[], {4, 5}]]], 10 ^ 3]Tally@Table[PositiveDefiniteMatrixQ[Covariance[RandomVariate[NormalDistribution[], {5, 5}]]], 10 ^ 3]Tally@Table[PositiveDefiniteMatrixQ[Covariance[RandomVariate[NormalDistribution[], {6, 5}]]], 10 ^ 3]Neat Examples (1)
Compute the statistic when the null hypothesis
is true:
data1 = RandomVariate[BinormalDistribution[.5], {250, 100}];T1 = MardiaCombinedTest[#, "TestStatistic"]& /@ data1;The test statistic given a particular alternative:
data2 = RandomVariate[MultivariateTDistribution[{{1, .2}, { .2, 1}}, 10], {250, 100}];T2 = MardiaCombinedTest[#, "TestStatistic"]& /@ data2;Compare the distributions of the test statistics:
SmoothHistogram[{T1, T2}, Filling -> Axis, PlotLegends -> {"SubscriptBox[H, 0] is True", "SubscriptBox[H, 0] is False"}, PlotRange -> All]Related Guides
History
Text
Wolfram Research (2010), MardiaCombinedTest, Wolfram Language function, https://reference.wolfram.com/language/ref/MardiaCombinedTest.html.
CMS
Wolfram Language. 2010. "MardiaCombinedTest." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MardiaCombinedTest.html.
APA
Wolfram Language. (2010). MardiaCombinedTest. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MardiaCombinedTest.html
BibTeX
@misc{reference.wolfram_2026_mardiacombinedtest, author="Wolfram Research", title="{MardiaCombinedTest}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/MardiaCombinedTest.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_mardiacombinedtest, organization={Wolfram Research}, title={MardiaCombinedTest}, year={2010}, url={https://reference.wolfram.com/language/ref/MardiaCombinedTest.html}, note=[Accessed: 12-June-2026]}