WilksW[m1,m2]
gives Wilks's for the matrices m1 and m2.
WilksW
WilksW[m1,m2]
gives Wilks's for the matrices m1 and m2.
Details
- WilksW[m1,m2] gives Wilks's between m1 and m2.
- Wilks's is a measure of linear dependence based on partitions of the pooled covariance matrix.
- Wilks's is computed as
where
is the covariance matrix of the pooled sample which can be partitioned into
, where
and
correspond to the covariance matrices of the individual datasets. - The arguments m1 and m2 can be any real‐valued matrices or vectors of equal length.
Examples
open all close allBasic Examples (3)
Compute Wilks's for two matrices:
m1 = RandomReal[1, {10^3, 4}];m2 = RandomReal[1, {10^3, 3}];WilksW[m1, m2]v1 = {3, -4, 1, 4, 22, 17, -2, 2, 13, -11};
v2 = {-20, -24, 0, 4, 24, 36, -12, -12, 56, -14};WilksW[v1, v2]Wilks's for a matrix and a vector:
m = RandomReal[1, {10^3, 4}];v = RandomReal[1, 10^3];WilksW[m, v]Scope (3)
Wilks's is typically used to detect linear dependence between random matrices:
Σ1 = IdentityMatrix[5];
Σ2 = {{12.8, 0.3, 3., -1.5, 5.1}, {0.3, 2.4, 0.9, -0.3, -0.8}, {3., 0.9, 6.5, 0.8, 1.3}, {-1.5, -0.3, 0.8, 1.4, 2.}, {5.1, -0.8, 1.3, 2., 11.1}};𝒟 = Table[MultinormalDistribution[ConstantArray[0, 5], Σ], {Σ, {Σ1, Σ2}}];data = RandomVariate[#, 1000]& /@ 𝒟;Values tend to be large for dependent matrices:
WilksW[data[[2, All, 1 ;; 3]], data[[2, All, 4 ;; 5]]]The value is much smaller for independent matrices:
WilksW[data[[1, All, 1 ;; 3]], data[[1, All, 4 ;; 5]]]Wilks's for machine-precision reals:
WilksW[{1.5, 3, 5, 10}, {2, 1.25, 15, 8}]WilksW[N[{1, 3, 5, 6, 6}, 30], N[{2, -1, 6, 8, 9}, 30]]Properties & Relations (3)
Wilks's measures linear dependence:
data = BlockRandom[SeedRandom[1];Table[RandomVariate[BinormalDistribution[i], 1000], {i, {-.99, -.75, -.25, -.5, 0., .25, .5, .75, .99}}]];Grid[Partition[Table[ListPlot[i, PlotStyle -> Directive[PointSize[Tiny]],
FrameTicks -> None, Frame -> True, Axes -> None, PlotLabel -> Row[{"𝒲 : ", WilksW[Sequence@@Transpose[i]]}]], {i, data}],
3]]Wilks's cannot detect nonlinear dependency:
uni = RandomReal[{-3, 3}, 1000];f[x_] := {{x, -Sqrt[Abs[x]] + RandomReal[.5]}, {x, .25x^2 + RandomReal[.5]}, {x, -Sinc[x] + RandomReal[.5]}, {Cos[x], Sin[x] + RandomReal[.5]}}data = f /@ uni;Table[ListPlot[data[[All, i]], Frame -> True, Axes -> None, PlotLabel -> Row[{"ρ : ", WilksW[Sequence@@Transpose[data[[All, i]]]]}], PlotStyle -> Directive[PointSize[Tiny]], FrameTicks -> None], {i, 4}]HoeffdingD can be used to detect some nonlinear dependence structures:
Table[HoeffdingD[data[[All, i]]][[1, 2]], {i, 4}]The statistical significance of can be tested using WilksWTest:
Σ = {{12.8, 0.3, 3., -1.5, 5.1}, {0.3, 2.4, 0.9, -0.3, -0.8}, {3., 0.9, 6.5, 0.8, 1.3}, {-1.5, -0.3, 0.8, 1.4, 2.}, {5.1, -0.8, 1.3, 2., 11.1}};data = RandomVariate[MultinormalDistribution[ConstantArray[0, 5], Σ], 10 ^ 2];WilksW[data[[All, 1 ;; 3]], data[[All, 4 ;; 5]]]WilksWTest[data[[All, 1 ;; 3]], data[[All, 4 ;; 5]], "TestDataTable"]Alternatively, use IndependenceTest to automatically choose a test:
IndependenceTest[data[[All, 1 ;; 3]], data[[All, 4 ;; 5]], "TestDataTable"]Related Guides
History
Text
Wolfram Research (2012), WilksW, Wolfram Language function, https://reference.wolfram.com/language/ref/WilksW.html.
CMS
Wolfram Language. 2012. "WilksW." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/WilksW.html.
APA
Wolfram Language. (2012). WilksW. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/WilksW.html
BibTeX
@misc{reference.wolfram_2026_wilksw, author="Wolfram Research", title="{WilksW}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/WilksW.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_wilksw, organization={Wolfram Research}, title={WilksW}, year={2012}, url={https://reference.wolfram.com/language/ref/WilksW.html}, note=[Accessed: 13-June-2026]}