Levene.Test {Analitica} | R Documentation |
Levene's Test for Homogeneity of Variances (Manual Implementation)
Description
Performs Levene's test for equality of variances across groups using a formula interface. This test evaluates the null hypothesis that the variances are equal across groups, and is commonly used as a preliminary test before ANOVA or other parametric analyses.
Usage
Levene.Test(formula, data, alpha = 0.05, center = "median")
Arguments
formula |
A formula of the form |
data |
A data frame containing the variables in the formula. |
alpha |
Significance level (default is 0.05). |
center |
Character string: use |
Details
Levene’s test is based on an analysis of variance (ANOVA) applied to the absolute deviations from each group’s center (either the mean or, more robustly, the median). It is less sensitive to departures from normality than Bartlett’s test.
Advantages: - Robust to non-normality, especially when using the median. - Suitable for equal or unequal sample sizes across groups. - Widely used in practice for checking homoscedasticity.
Disadvantages: - Less powerful than parametric alternatives under strict normality.
Value
An object of class "homocedasticidad"
, containing:
- Statistic
F statistic of the Levene test.
- df
Degrees of freedom (between and within groups).
- p_value
The p-value for the test.
- Decision
"Homoscedastic"
or"Heteroscedastic"
depending on the test result.- Method
A string indicating the method used ("Levene").
References
Levene, H. (1960). "Robust Tests for Equality of Variances." In Contributions to Probability and Statistics: Essays in Honor of Harold Hotelling (pp. 278–292). Stanford University Press.
Examples
data(d_e, package = "Analitica")
res <- Levene.Test(Sueldo_actual ~ labor, data = d_e)
summary(res)