2
$\begingroup$

I don't understand what the difference is between TypeI and TypeIII? Since my background is not very mathematics, it's very difficult for me to understand this mathematical notation; Type I SS: SS(A) SS(B|A) SS (AB|A, B) Type II SS: SS(A|B) SS(B|A) SS (AB|A, B) Type III SS: SS (A|B, AB) SS (B|A, AB) SS (A*B|A, B)?

I want to check the interaction between my two factors (genotype*FuncBIN), but my output comes as Type II ANOVA with interaction. Is this normal?

structure( list(genotype = structure(c(3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("WT", "Mut2", "Mut1" ), class = "factor"), FuncBIN = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L), .Label = c("Mitochondria ", "Golgi", "ER"), class = "factor"), k = c(0.2, 0.3, 0.4, 0.5, 0.3, 0.2, 0.5, 0.6, 0.7, 0.4, 0.6, 0.9, 0.2, 0.3, 0.5, 0.4, 0.2, 0.3, 0.5, 0.6, 0.8, 0.5, 0.4, 0.6, 0.2, 0.3, 0.1)), .Names = c("genotype", "FuncBIN", "k"), class = "data.frame", row.names = c(NA, -27L) )


library(car)
library(lsmeans)
library(multcomp)
fit <- lm(k ~ genotype + FuncBIN + genotype*FuncBIN, df) 
plot(fit) shapiro.test(residuals(fit)) 
Anova(fit) 
lsmip(fit, FuncBIN ~ genotype) 
lsmeans(fit, pairwise ~ genotype)[[2]]
fit.tukey <- lsmeans(fit, pairwise ~ genotype | FuncBIN)[[2]]
fit.tukey
cld(fit.tukey)

How can I run an ANOVA with interaction followed my Tukey PostHOC?

$\endgroup$
  • $\begingroup$ Thank you, EdM, but I need a simple explanation to understand this + how to improve my R coding for this? $\endgroup$ – Kynda May 11 '18 at 14:53
  • 2
    $\begingroup$ Read the "|" sign as "given. That is, for type II ANOVA, "SS(A|B)" means to test A given what is known about B; "SS(B|A)" means to test B given what is known about A; "SS (AB|A, B)" means to test the AB interaction given what is known about A and B individually. So type II (as recommended by @dbwilson) does provide a test for the interaction itself; in type II the interaction term, unlike in type III tests, is not included in the tests for main effects of A and B. $\endgroup$ – EdM May 11 '18 at 16:08
  • 2
    $\begingroup$ I think you will find the information you need in the linked thread. Please read it. If it isn't what you want / you still have a question afterwards, come back here & edit your question to state what you learned & what you still need to know. Then we can provide the information you need without just duplicating material elsewhere that already didn't help you. $\endgroup$ – gung - Reinstate Monica May 11 '18 at 16:26
4
$\begingroup$

In a balanced design, all three of these model types will yield the same results. With unbalanced data, you will get different results for the main effects but not the interaction term, assuming you only have a two-way interaction (as in your example). The general advice is to use a Type II sums-of-squares model for unbalanced designs. This model tests the main effects without the interaction term. The difference comes down to how you weight each mean or cell of the factorial. In a Type III model, each cell of the factorial gets the same weight (even if some have smaller sample sizes). In a Type II model, each observation gets the same weight. In most situations (but not all!) the latter is more defensible.

If you are only interested in the interaction, then this decision doesn't matter. The sum-of-squares for the interaction will be the same for all three model types.

I just checked and your design is balanced. As such you can use Type III SS. Built-in R functions will work just fine here.

fit <- aov(k ~ genotype*FuncBIN, data=df)
summary(fit)
TukeyHSD(fit)
| cite | improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ In practice, however, there will appear to be a difference when this is done with Anova() in the car package. Its Type II tests do not include an intercept term, while its Type III tests do. See this R-help thread. $\endgroup$ – EdM May 11 '18 at 18:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.