Learn R Programming

groupcompare (version 1.0.1)

levene.test: Levene Test for Homogeneity of Variances

Description

This function performs the Levene test to check the homogeneity of variances across groups.

Usage

levene.test(ds)

Value

A single numeric value named Levene.p, representing the p-value of the Levene test.

Arguments

ds

A data frame with two columns: the first column contains numeric values, and the second column contains group labels.

Author

Zeynel Cebeci, A. Firat Ozdemir, Engin Yildiztepe

Details

The function calculates the absolute deviations from the group means, performs an ANOVA on these deviations, and returns the p-value of the Levene test.

Examples

Run this code
df <- data.frame(values = c(1.1, 2.3, 2.5, 3.7, 1.2, 2.1, 3.4, 3.9),
  groups = c("A", "A", "B", "B", "A", "A", "B", "B"))
levene.test(df)

Run the code above in your browser using DataLab