I am trying to perform a levenetest on my two-way anova.
leveneTest(Score ~ Party + Group, data = Data)
But R just screams at me saying
Error in leveneTest.formula(formula(y), data = model.frame(y), ...) : Model must be completely crossed formula only.
Best Answer
I think you are getting an error as your model does not include an interaction term. I would try first creating a model fit using the lm
function:
fit <- lm(Score ~ Party + Group, data = Data)
and then using the levene.test
function in the s20x
package as it is a little less finicky.
levene.test(fit)
In saying all that, levene tests are actually a really poor way of checking equality of variance (EoV). They are overly sensitive to deviations, while ANOVAs are actually quite robust. You are better off just looking at a plot (i.e. plot(fit, which =1)
) and visually assessing it for EoV. If it is for an assignment that requires it, then ignore the latter advice. Also, the samething goes for normality and the shapiro-wilks test….
Similar Posts:
- Solved – Smallest possible sample size per group in Levene’s test
- Solved – Linear Regression In R and test of constant variance
- Solved – How to interpret p=0 in ncvTest
- Solved – Comparison of p values for Levene mean test and Levene median test
- Solved – How to you test homogeneity of variance of two groups with different sample sizes