dataFrame.columns.stat — levene()
Description
The levene() method of the stat object performs Levene's test for equality of variances across the selected columns.
Signature
dataFrame.columns(...columnNames).stat.levene({ sorted: false })Arguments
...columnNames( string[] )- The name of the columns from which to compute Leven's test.
options(object)- Levene test options.
Option
sorted(boolean)- Indicates whether the values are already sorted in ascending order.
- Sorted:
true - Not sorted:
false(default)
- Sorted:
Returns
stat(object)- A statistic object containing the Levene test results.
W_stat(number)- The Levene test statistic.
p_value(number)- The p-value associated with the test statistic.
confidence(number)- A confidence score computed as
1 - p_value. df_between(number)- The between-groups degrees of freedom.
df_within(number)- The within-groups degrees of freedom.
Notes
- The method requires at least two selected columns.
- The null hypothesis states that all groups have equal variances.
- Small p-values indicate evidence against the assumption of equal variances.
- The confidence score is calculated as
1 - p_value. - Levene's test is less sensitive to departures from normality than Bartlett's test.
- The test is commonly used before performing ANOVA or other variance-based procedures.
Example
// compute the Levene test on values of multiple columns of the dataFrame
var stat = dataFrame.columns('groupA', 'groupB').stat.levene();
// log the stat details
notebook.log(stat);