anovaFK | R Documentation |
The function 'anovaFK' - contains two separate tests: in a first state, the Fligner-Killeen test for the homogeneity of variances is run, and function of this test, the Welch approximation is applied if the groups are not homogeneous.
anovaFK(x, y = NULL, data)
x |
A vector of values or a formula object as in 'lhs ~ rhs', unde 'lhs' contains the values and the 'rhs' contains the groups. Both can be vectors or variables from a dataset. |
y |
An optional vector of values, when the two variables are not specified using a formula object. |
data |
A dataset containing the variables specified in the formula object, in case they don't exist as separate objects. |
When the variances are not equal, the output differs from the one presented by oneway.test, but the table is similar.
If the degrees of freedom are not what they should be (k - 1
, and n - k
respectively) something must be wrong. Specifically, the grouping variable should be
declared as a factor (in case it is not already character), otherwise it is considered
metric and a regression model is applied instead of ANOVA.
Declaring a variable as a factor is done using the command: as.factor
Adrian Dusa
aov
, anova
, oneway.test
, fligner.test
values <- c(15, 8, 17, 7, 26, 12, 8, 11, 16, 9, 16, 24, 20, 19, 9, 17, 11, 8, 15, 6, 14)
groups <- rep(1:3, each = 7)
anovaFK(values ~ groups)
# same thing with:
anovaFK(values, groups)
# using a dataset
vgdf <- data.frame(values, groups)
using(vgdf, anovaFK(values ~ groups))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.