3

Why does this:

fligner.test(a ~ b + c + d, data=df)

and this

fligner.test(a ~ b + d, data=df)

always equal for whatever data.

In the meantime, this

fligner.test(a ~ b + c + d, data=df)

and this

fligner.test(a ~ c + b + d, data=df)

do not equal.

Here is an example of data

set.seed(11)

df = data.frame(a=rnorm(12), b=factor(rep(c(1,2,3),4)), c=factor(rep(c(1,2),6)), d=rnorm(12))

It seems that only the first variable of the formula is considered. Does it mean that if we want to test the homoscedasticity of such model

aov(a ~ c + b + d, data=df)

we should run:

filgner.test(a ~ b, data=df)
filgner.test(a ~ c, data=df)
filgner.test(a ~ d, data=df)

and if all of them are not significantly heteroscedastic, we can accept that our model respect the assumption of homoscedasticity. Is it correct? Note that the same effect is found with the bartlett.test(..)

Remi.b
  • 4,572
  • 12
  • 34
  • 64

1 Answers1

3

The R function 'fligner.test' takes into account only the first factor, that's right. A multiway anova with interaction could be handled in 'fligner.test' by creating a single variable distinguishing all groups, e.g. using

fligner.test(a ~ interaction(b, c, d)).

Tests for equal variances are generally not considered as being very useful, e.g. since null and working hypotheses are reversed, which wrongly favours small sample situations. Thus, I suggest to visually inspect the relevant residual plots instead of performing three not very smart tests.

Michael M
  • 10,553
  • 5
  • 27
  • 43