Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

levene_test

Levene's Test


Description

Provide a pipe-friendly framework to easily compute Levene's test for homogeneity of variance across groups.

Wrapper around the function leveneTest(), which can additionally handles a grouped data.

Usage

levene_test(data, formula, center = median)

Arguments

data

a data frame for evaluating the formula or a model

formula

a formula

center

The name of a function to compute the center of each group; mean gives the original Levene's test; the default, median, provides a more robust test.

Value

a data frame with the following columns: df1, df2 (df.residual), statistic and p.

Examples

# Prepare the data
data("ToothGrowth")
df <- ToothGrowth
df$dose <- as.factor(df$dose)
# Compute Levene's Test
df %>% levene_test(len ~ dose)

# Grouped data
df %>%
  group_by(supp) %>%
  levene_test(len ~ dose)

rstatix

Pipe-Friendly Framework for Basic Statistical Tests

v0.7.0
GPL-2
Authors
Alboukadel Kassambara [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.