Provides a pipe-friendly framework to perform the Fligner-Killeen
test, a non-parametric (rank-based) test of the homogeneity of group
variances. It is robust against departures from normality and is a useful
alternative to levene_test(). Wrapper around the function
fligner.test().
fligner_test(data, formula, ...)a data.frame containing the variables in the formula.
a formula of the form x ~ group where x is a
numeric variable giving the data values and group is a factor with
one or multiple levels giving the corresponding groups. For example,
formula = TP53 ~ cancer_group.
other arguments to be passed to the function
fligner.test.
return a data frame with the following columns:
.y.: the y variable used in the test.
n: sample count.
statistic: the Fligner-Killeen test statistic (a chi-squared
statistic) used to compute the p-value.
df: the degrees of
freedom.
p: p-value.
method: the statistical test
used to compare groups.
# Load data
#:::::::::::::::::::::::::::::::::::::::
data("ToothGrowth")
df <- ToothGrowth
# Fligner-Killeen test
#:::::::::::::::::::::::::::::::::::::::::
df %>% fligner_test(len ~ dose)
#> # A tibble: 1 × 6
#> .y. n statistic df p method
#> * <chr> <int> <dbl> <dbl> <dbl> <chr>
#> 1 len 60 1.39 2 0.500 Fligner-Killeen
# Grouped data
df %>%
group_by(supp) %>%
fligner_test(len ~ dose)
#> # A tibble: 2 × 7
#> supp .y. n statistic df p method
#> * <fct> <chr> <int> <dbl> <dbl> <dbl> <chr>
#> 1 OJ len 30 3.30 2 0.192 Fligner-Killeen
#> 2 VC len 30 3.82 2 0.148 Fligner-Killeen