3

I have to run an multiple way Anova and want to test the assumption of homoscedasticity.

How can I run a Fligner.test with several independent variables (variables indicating the grouping) with R? Does it make sense to do such a thing?

Remi.b
  • 4,572
  • 12
  • 34
  • 64
  • Oh and indeed, in the R help I see that I can use a formula. Therefore it works. I thought I could only two input in the function `x`and `g`. Ok, thank you! – Remi.b Nov 04 '13 at 13:09
  • 1
    Your other question is worth mentioning here: [Inspecting assumption of homoscedasticity](http://stats.stackexchange.com/q/76973/32036) – Nick Stauner Jan 10 '14 at 17:57

2 Answers2

2

There are two ways of using the fligner.test() function. You can either do

fligner.test(x=…, g=…)

or

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

The second case allows to check an anova model with several independent variables.

And yes, it totally makes sense to run a Fligner test with several grouping variables.

Remi.b
  • 4,572
  • 12
  • 34
  • 64
  • 2
    Usually one-line answers aren't regarded as appropriate, and in this case, you should probably expand on it to also respond to your second question (presumably in the affirmative). – Glen_b Nov 04 '13 at 13:48
0

Be careful with the use of the formula fligner.test(formula= a~b+c+d, data=your_data).

The fligner.test will only take into account the first factor when you use this notation (see example here).

A more appropriate way to handle multiple independent variables is with the formula fligner.test(a ~ interaction(a, b, c, d), data=your_data). This will make sure that the order you use for your independent variables does not impact your output (i.e., p-value).