1

I tried to do ANOVA with my data. I want to check if there is an interaction effect between two factors. I use the code:

anova_3<- anova(lm(response ~ Fac_A * Fac_B, data,  type=3))

But I got an error

In lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : extra argument ‘type’ will be disregarded

No matter what type I tried, always got the same answer and the same error. There are no NAs in my data.

wibeasley
  • 5,000
  • 3
  • 34
  • 62
Xin.S
  • 11
  • 2
  • 1
    Welcome to StackOverflow! For code debugging please always ask with a [reproducible](https://stackoverflow.com/q/5963269/1422451) example per the [MCVE](https://stackoverflow.com/help/mcve) and [`r`](https://stackoverflow.com/tags/r/info) tag description, with the desired output. – Hack-R Jun 26 '18 at 16:35
  • 1
    Was it a warning or an error? It's just telling you that `type` isn't an argument that `lm` uses, so it ignores it. If you're trying to specify what type of sum of squares to use, see [this question](https://stats.stackexchange.com/questions/20452/how-to-interpret-type-i-type-ii-and-type-iii-anova-and-manova/20455#20455) on `crossvalidated`. – Anonymous coward Jun 26 '18 at 16:35
  • 1
    Use the `Anova` function of the `car` package. – Stéphane Laurent Jun 26 '18 at 19:37

1 Answers1

1

Please try this:

library(car)
anova_3 <- Anova(lm(response ~ Fac_A * Fac_B, data),  type=3).

I found this link very useful: https://stat.ethz.ch/pipermail/r-help/2012-June/315986.html

Hope it helps.

Vicky Yang
  • 11
  • 1