LeveneTest
✖
LeveneTest
Details and Options



- LeveneTest tests the null hypothesis
against the alternative hypothesis
:
-
data {data1,data2} {data1,data2,…} not all equal - where σi2 is the population variance for datai.
- By default, a probability value or
-value is returned.
- A small
-value suggests that it is unlikely that
is true.
- The data in dspec must be univariate {x1,x2,…}.
- The argument
can be any positive real number. The default value of
is 1 if not specified, and ignored if the number of groups in dspec is more than 2.
- The LeveneTest assumes the data is normally distributed and, for the two-sample case, is much less sensitive to this assumption than the FisherRatioTest.
- LeveneTest[data,
,"HypothesisTestData"] returns a HypothesisTestData object htd that can be used to extract additional test results and properties using the form htd["property"].
- LeveneTest[data,
,"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" list of -values
"PValueTable" formatted table of -values
"ShortTestConclusion" a short description of the conclusion of a test "TestConclusion" a description of the conclusion of a test "TestData" list of pairs of test statistics and -values
"TestDataTable" formatted table of -values and test statistics
"TestStatistic" list of test statistics "TestStatisticTable" formatted table of test statistics - When one sample of size
is given, the LeveneTest is equivalent to the FisherRatioTest.
- For the
-sample case {data1,data2,…,datak} with datai={xi,1,xi,2,…,xi,ni}, the test statistic is given by
, where zi,j=Abs[xi,j-Mean[datai]], zi=Mean[{zi,1,zi,2,…,zi,ni}], and z=Mean[{z1,z2,…,zk}]. The test statistic is assumed to follow FRatioDistribution[k-1,
(ni-1)] under
.
- The following options can be used:
-
AlternativeHypothesis "Unequal" the inequality for the alternative hypothesis SignificanceLevel 0.05 cutoff for diagnostics and reporting VerifyTestAssumptions Automatic set which diagnostic tests to run - For the LeveneTest, 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. This value
is also used in diagnostic tests of assumptions, including tests for normality and symmetry. By default,
is set to 0.05.
- Named settings for VerifyTestAssumptions in LeveneTest include:
-
"Normality" verify that all data is normally distributed
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Test variances from two populations for equality:

https://wolfram.com/xid/01zbsjrfjja-kd5itj

https://wolfram.com/xid/01zbsjrfjja-lpfld5

Create a HypothesisTestData object for further property extraction:

https://wolfram.com/xid/01zbsjrfjja-ybn5y


https://wolfram.com/xid/01zbsjrfjja-yfec

Compare the variance of a population to a particular value:

https://wolfram.com/xid/01zbsjrfjja-lbi4hl

https://wolfram.com/xid/01zbsjrfjja-eocrh


https://wolfram.com/xid/01zbsjrfjja-c8qh6

Test against the alternative hypothesis :

https://wolfram.com/xid/01zbsjrfjja-dov9ba

Scope (10)Survey of the scope of standard use cases
Testing (8)
Test whether the variance of a population is 1:

https://wolfram.com/xid/01zbsjrfjja-rausuz

https://wolfram.com/xid/01zbsjrfjja-5wf5k
The -value is uniformly distributed in [0,1] under
:

https://wolfram.com/xid/01zbsjrfjja-dea8hq

The histogram of a sample of -values of the Levene test:

https://wolfram.com/xid/01zbsjrfjja-mhkaek

https://wolfram.com/xid/01zbsjrfjja-ps9g5i

The -value is typically small when
is false:

https://wolfram.com/xid/01zbsjrfjja-fqzjg9

https://wolfram.com/xid/01zbsjrfjja-qmkias

https://wolfram.com/xid/01zbsjrfjja-g42zuc

Compare the variance of a population to a particular value:

https://wolfram.com/xid/01zbsjrfjja-0x7z21

https://wolfram.com/xid/01zbsjrfjja-bev4t3

https://wolfram.com/xid/01zbsjrfjja-m689y


https://wolfram.com/xid/01zbsjrfjja-bzzuwt

Compare the variances of two populations:

https://wolfram.com/xid/01zbsjrfjja-6qd6cf

https://wolfram.com/xid/01zbsjrfjja-mk1rwj
The -value is uniformly distributed in [0,1] under
:

https://wolfram.com/xid/01zbsjrfjja-dcnktx

The histogram of a sample of -values of the Levene test:

https://wolfram.com/xid/01zbsjrfjja-47e9dv

https://wolfram.com/xid/01zbsjrfjja-lahxcm

The -value is typically small when the variances are not equal:

https://wolfram.com/xid/01zbsjrfjja-jgjgqh

https://wolfram.com/xid/01zbsjrfjja-3jwr9q

https://wolfram.com/xid/01zbsjrfjja-b15esj

Test whether the ratio of the variances of two populations is a particular value:

https://wolfram.com/xid/01zbsjrfjja-nh4zv9

https://wolfram.com/xid/01zbsjrfjja-d2atk

https://wolfram.com/xid/01zbsjrfjja-qem1d
The following forms are equivalent:

https://wolfram.com/xid/01zbsjrfjja-f4bmuo


https://wolfram.com/xid/01zbsjrfjja-gompwh

The order of the datasets should be considered when determining :

https://wolfram.com/xid/01zbsjrfjja-6e1y8

Test whether the variances of three populations are identical:

https://wolfram.com/xid/01zbsjrfjja-ean2ma

https://wolfram.com/xid/01zbsjrfjja-g4kkl

https://wolfram.com/xid/01zbsjrfjja-fg4d3t

Create a HypothesisTestData object for repeated property extraction:

https://wolfram.com/xid/01zbsjrfjja-vo9sor

https://wolfram.com/xid/01zbsjrfjja-0x5m5

https://wolfram.com/xid/01zbsjrfjja-cc8eh1
The properties available for extraction:

https://wolfram.com/xid/01zbsjrfjja-frvg20

Extract some properties from a HypothesisTestData object:

https://wolfram.com/xid/01zbsjrfjja-j8zm7r

https://wolfram.com/xid/01zbsjrfjja-c03go

https://wolfram.com/xid/01zbsjrfjja-bpn9dr
The -value, test statistic, and degrees of freedom:

https://wolfram.com/xid/01zbsjrfjja-365dq


https://wolfram.com/xid/01zbsjrfjja-bn5rjv


https://wolfram.com/xid/01zbsjrfjja-cm9bof

Extract any number of properties simultaneously:

https://wolfram.com/xid/01zbsjrfjja-onp01a

https://wolfram.com/xid/01zbsjrfjja-bycagv

https://wolfram.com/xid/01zbsjrfjja-dmu6hk
The -value, test statistic, and degrees of freedom:

https://wolfram.com/xid/01zbsjrfjja-i6fwj7

Reporting (2)

https://wolfram.com/xid/01zbsjrfjja-j7ol0s

https://wolfram.com/xid/01zbsjrfjja-ba6zb1

https://wolfram.com/xid/01zbsjrfjja-hb1mu5

https://wolfram.com/xid/01zbsjrfjja-hh3kq

The values from the table can be extracted using "TestData":

https://wolfram.com/xid/01zbsjrfjja-25755

Tabulate -values or test statistics:

https://wolfram.com/xid/01zbsjrfjja-39b2t0

https://wolfram.com/xid/01zbsjrfjja-fr3ezf

https://wolfram.com/xid/01zbsjrfjja-blo8x

https://wolfram.com/xid/01zbsjrfjja-g8i1dt


https://wolfram.com/xid/01zbsjrfjja-o0wuj


https://wolfram.com/xid/01zbsjrfjja-kx4361

The test statistic from the table:

https://wolfram.com/xid/01zbsjrfjja-bitsqd

Options (8)Common values & functionality for each option
AlternativeHypothesis (3)
A two-sided test is performed by default:

https://wolfram.com/xid/01zbsjrfjja-bgoxnx

https://wolfram.com/xid/01zbsjrfjja-he0w0s


https://wolfram.com/xid/01zbsjrfjja-jqt2u8

Perform a two-sided test or a one-sided alternative:

https://wolfram.com/xid/01zbsjrfjja-kwmm8d

https://wolfram.com/xid/01zbsjrfjja-dy0fuc


https://wolfram.com/xid/01zbsjrfjja-g8h639


https://wolfram.com/xid/01zbsjrfjja-f19ykz

Perform tests with one-sided alternatives when a null value is given:

https://wolfram.com/xid/01zbsjrfjja-cay5xk

https://wolfram.com/xid/01zbsjrfjja-v01gr


https://wolfram.com/xid/01zbsjrfjja-ci67wa


https://wolfram.com/xid/01zbsjrfjja-m3sbc

SignificanceLevel (2)
Set the significance level for diagnostic tests:

https://wolfram.com/xid/01zbsjrfjja-fn2ahc

https://wolfram.com/xid/01zbsjrfjja-dwfi1


https://wolfram.com/xid/01zbsjrfjja-cod4ca


The significance level is also used for "TestConclusion" and "ShortTestConclusion":

https://wolfram.com/xid/01zbsjrfjja-bhkod7

https://wolfram.com/xid/01zbsjrfjja-lasldz

https://wolfram.com/xid/01zbsjrfjja-hykroc

https://wolfram.com/xid/01zbsjrfjja-bvt7nt


https://wolfram.com/xid/01zbsjrfjja-hpqqgh


https://wolfram.com/xid/01zbsjrfjja-flavjg


https://wolfram.com/xid/01zbsjrfjja-m2oyg2

VerifyTestAssumptions (3)
Diagnostics can be controlled as a group using All or None:

https://wolfram.com/xid/01zbsjrfjja-ma0mld

https://wolfram.com/xid/01zbsjrfjja-bg3dnp



https://wolfram.com/xid/01zbsjrfjja-foxivl

Diagnostics can be controlled independently:

https://wolfram.com/xid/01zbsjrfjja-btjvx7

https://wolfram.com/xid/01zbsjrfjja-djybum


Set the normality assumption to True:

https://wolfram.com/xid/01zbsjrfjja-ioa6i3

It is often useful to bypass diagnostic tests for simulation purposes:

https://wolfram.com/xid/01zbsjrfjja-kfpeh6

https://wolfram.com/xid/01zbsjrfjja-cxjgtt

The assumptions of the test hold by design, so a great deal of time can be saved:

https://wolfram.com/xid/01zbsjrfjja-cmfh98


https://wolfram.com/xid/01zbsjrfjja-btr43n

Applications (1)Sample problems that can be solved with this function
Set up a test for constant error variance using Levene's test, which partitions the data into two equal pieces:

https://wolfram.com/xid/01zbsjrfjja-fmr6yi
Generate some data for multiple regression analysis:

https://wolfram.com/xid/01zbsjrfjja-dcu86

https://wolfram.com/xid/01zbsjrfjja-d01rfi
The residuals plotted against each predictor variable:

https://wolfram.com/xid/01zbsjrfjja-bw7qbg


https://wolfram.com/xid/01zbsjrfjja-bclc9k
The first variable is positively correlated with its variance:

https://wolfram.com/xid/01zbsjrfjja-eik5un

Properties & Relations (8)Properties of the function, and connections to other functions
The Levene test is equivalent to FisherRatioTest when a single dataset is given:

https://wolfram.com/xid/01zbsjrfjja-q3di42

https://wolfram.com/xid/01zbsjrfjja-j5fqwv

https://wolfram.com/xid/01zbsjrfjja-kub30


https://wolfram.com/xid/01zbsjrfjja-fvhuu5

Given a single dataset with length , the test statistic follows a ChiSquareDistribution[n-1] under
:

https://wolfram.com/xid/01zbsjrfjja-dcdb2r

https://wolfram.com/xid/01zbsjrfjja-fnfl43

https://wolfram.com/xid/01zbsjrfjja-b8509h

https://wolfram.com/xid/01zbsjrfjja-lqhzmf

The maximum-likelihood estimate of the degrees of freedom is near :

https://wolfram.com/xid/01zbsjrfjja-bq1j1i


https://wolfram.com/xid/01zbsjrfjja-46lw9

Given two datasets with lengths and
, the test statistic follows an FRatioDistribution[1,n+m-2] under
:

https://wolfram.com/xid/01zbsjrfjja-mjh6vh

https://wolfram.com/xid/01zbsjrfjja-naqqrz

https://wolfram.com/xid/01zbsjrfjja-hkcfe1


https://wolfram.com/xid/01zbsjrfjja-bvu6jc

The Levene test is less sensitive to the assumption of normality than the FisherRatioTest:

https://wolfram.com/xid/01zbsjrfjja-b5a6xr

https://wolfram.com/xid/01zbsjrfjja-hvtvke

https://wolfram.com/xid/01zbsjrfjja-40l62

https://wolfram.com/xid/01zbsjrfjja-d36rxi
The Fisher ratio test tends to underestimate the -value and commit more Type I errors:

https://wolfram.com/xid/01zbsjrfjja-f0xgxt

The two-sample test statistic:

https://wolfram.com/xid/01zbsjrfjja-haesu6

https://wolfram.com/xid/01zbsjrfjja-8bjjrh

https://wolfram.com/xid/01zbsjrfjja-bqhrkb

https://wolfram.com/xid/01zbsjrfjja-dgwwe

https://wolfram.com/xid/01zbsjrfjja-91x6y

https://wolfram.com/xid/01zbsjrfjja-enkakr


https://wolfram.com/xid/01zbsjrfjja-dl9jp

The three-sample test statistic:

https://wolfram.com/xid/01zbsjrfjja-fq0ely

https://wolfram.com/xid/01zbsjrfjja-1ntapz

https://wolfram.com/xid/01zbsjrfjja-kwhhvy

https://wolfram.com/xid/01zbsjrfjja-idenw6

https://wolfram.com/xid/01zbsjrfjja-ejhx8d

https://wolfram.com/xid/01zbsjrfjja-lvlhgt


https://wolfram.com/xid/01zbsjrfjja-f0by32

The Levene test works with the values only when the input is a TimeSeries:

https://wolfram.com/xid/01zbsjrfjja-7py5sj

https://wolfram.com/xid/01zbsjrfjja-57bf57


https://wolfram.com/xid/01zbsjrfjja-vvd88

The Levene test works with all the values together when the input is a TemporalData:

https://wolfram.com/xid/01zbsjrfjja-qry3ls

https://wolfram.com/xid/01zbsjrfjja-b1l4g0


https://wolfram.com/xid/01zbsjrfjja-t6toez

Test whether the variances of the two paths are equal:

https://wolfram.com/xid/01zbsjrfjja-kxzwhd

https://wolfram.com/xid/01zbsjrfjja-jdvl55

Possible Issues (3)Common pitfalls and unexpected behavior
The Levene test assumes the data is drawn from a NormalDistribution:

https://wolfram.com/xid/01zbsjrfjja-b36obx

https://wolfram.com/xid/01zbsjrfjja-kddjr2


Use ConoverTest or SiegelTukeyTest for non-normal data:

https://wolfram.com/xid/01zbsjrfjja-ee5if9


https://wolfram.com/xid/01zbsjrfjja-1yubo

The Levene test ignores the argument when there are more than 2 groups:

https://wolfram.com/xid/01zbsjrfjja-ci0pq0

https://wolfram.com/xid/01zbsjrfjja-zpcoai


https://wolfram.com/xid/01zbsjrfjja-pihxsk


When there are more than 2 groups in the data, the Levene test only allows the two-sided test for the alternative hypothesis:

https://wolfram.com/xid/01zbsjrfjja-dxk2k3

https://wolfram.com/xid/01zbsjrfjja-comr9a


https://wolfram.com/xid/01zbsjrfjja-l6buo



https://wolfram.com/xid/01zbsjrfjja-csh51


Neat Examples (1)Surprising or curious use cases
Compute the statistic when the null hypothesis is true:

https://wolfram.com/xid/01zbsjrfjja-2qqg3c

https://wolfram.com/xid/01zbsjrfjja-ywy3ty
The test statistic given a particular alternative:

https://wolfram.com/xid/01zbsjrfjja-c5cy2n
Compare the distributions of the test statistics:

https://wolfram.com/xid/01zbsjrfjja-87eb6q

Wolfram Research (2010), LeveneTest, Wolfram Language function, https://reference.wolfram.com/language/ref/LeveneTest.html (updated 2017).
Text
Wolfram Research (2010), LeveneTest, Wolfram Language function, https://reference.wolfram.com/language/ref/LeveneTest.html (updated 2017).
Wolfram Research (2010), LeveneTest, Wolfram Language function, https://reference.wolfram.com/language/ref/LeveneTest.html (updated 2017).
CMS
Wolfram Language. 2010. "LeveneTest." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2017. https://reference.wolfram.com/language/ref/LeveneTest.html.
Wolfram Language. 2010. "LeveneTest." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2017. https://reference.wolfram.com/language/ref/LeveneTest.html.
APA
Wolfram Language. (2010). LeveneTest. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LeveneTest.html
Wolfram Language. (2010). LeveneTest. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LeveneTest.html
BibTeX
@misc{reference.wolfram_2025_levenetest, author="Wolfram Research", title="{LeveneTest}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/LeveneTest.html}", note=[Accessed: 26-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_levenetest, organization={Wolfram Research}, title={LeveneTest}, year={2017}, url={https://reference.wolfram.com/language/ref/LeveneTest.html}, note=[Accessed: 26-March-2025
]}