The function performs the robust Brown-Forsythe test using the group medians.
Arguments
- formula
a formula of the form lhs ~ rhs where lhs gives the sample values and rhs the corresponding groups.
- data
a tibble or data frame containing the variables in formula.
- alpha
the level of significance to assess the statistical difference. Default is set to alpha = 0.05.
- na.rm
a logical value indicating whether NA values should be stripped before the computation proceeds. Default us set to TRUE.
- verbose
a logical for printing output to R console.
Value
A list with class "owt" containing the following components:
- statistic
the Brown-Forsythe test statistic.
- parameter
the parameter(s) of the approximate F distribution of the test statistic.
- p.value
the p-value of the test.
- alpha
the level of significance to assess the statistical difference.
- method
the character string "Brown-Forsythe-Median Test".
- data
a data frame containing the variables in which NA values (if exist) are removed.
- formula
a formula of the form lhs ~ rhs where lhs gives the sample values and rhs the corresponding groups.
Details
Levene (1960) proposed a test for homogeneity of variances in k groups which is based on the ANOVA statistic applied to absolute deviations of observations from the corresponding group mean. The robust Brown-Forsythe version of the Levene-type test substitutes the group mean by the group median in the classical Levene statistic.
References
Brown, M. B. and Forsythe, A.B. (1974). Robust tests for
equality of variances.
Journal of the American Statistical Association, 69,
364-367.
Levene, H. (1960).
Robust Tests for Equality of Variances, in Contributions
to Probability and Statistics, ed. I. Olkin, Palo Alto, CA: Stanford Univ.
Press.
Examples
data(pheno)
data(geno)
df <- data.frame(phenotype = pheno, genotype = as.factor(geno[, 911]))
bfmedian.test(phenotype ~ genotype, data = df)
#>
#> Brown-Forsythe-Median Test based on deviations from the median (alpha = 0.05)
#> -------------------------------------------------------------
#> data : phenotype and genotype
#>
#> statistic : 0.4520045
#> num df : 1
#> denom df : 91
#> p.value : 0.5030881
#>
#> Result : Difference is not statistically significant.
#> -------------------------------------------------------------
#>