I have a small sample unbalanced RCBD, where I have reason to suspect unequal variances, hence I wish to fit a ANOVA with type-3 SS with heterscedasticity consistent esimators. The simplest way to do this is to utilize Anova() function from the package CAR, however, I cannot for the life of me understand how to run post hoc tests after using this function. Multcomp() doesnt let me use the object created in Anova(), neither will it let be use the similar (although without hce) drop1() objects. Can anyone help me with this? I know I can do this in SAS but I much rather learn to do it in R.
Solved – Post hoc tests from Anova() from car-package
anovaheteroscedasticitypost-hoc
Related Solutions
After reporting the significance and type of your ANOVA test, you can create a figure showing the difference between the means and the confidence intervals for each pair of groups with significant differences, providing the p-value for each pairwise comparison. In addition it is adviced to correct for multiple testing if the number of groups is large, and to filter those results with low size effects.
Below there is a possible representation in which the difference in mean proportions of genes belonging to Glycolysis pathways is tested across 6 different groups. Each row represents a pairwise comparison and in columns there are, from left to right, the comparison performed (e.g. group 5 vs group 6), the mean proportion for each group (bar plot), the difference in mean proportions (confidence interval), and the p-value (uncorrected for multiple testing, it would be adviced to add "corrected" in the label otherwise).
EDIT
In this post it is shown how to use the library multicompView
to perform a Tukey Test and to generate a representation similar to the one I shown above (which was created with STAMP and hence it limited to a particular type of data). For completeness, I paste the example of the code proposed in that post:
# library
library(multcompView)
# Create data
set.seed(1)
treatment <- rep(c("A", "B", "C", "D", "E"), each=20)
value=c( sample(2:5, 20 , replace=T) , sample(6:10, 20 , replace=T), sample(1:7, 20 , replace=T), sample(3:10, 20 , replace=T) , sample(10:20, 20 , replace=T) )
data=data.frame(treatment,value)
# What is the effect of the treatment on the value ?
model=lm( data$value ~ data$treatment )
ANOVA=aov(model)
# Tukey test to study each pair of treatment :
TUKEY <- TukeyHSD(x=ANOVA, 'data$treatment', conf.level=0.95)
# Tuckey test representation :
plot(TUKEY , las=1 , col="brown")
```
The post hoc tests following an ANOVA are pairwise t tests for mean difference. They have null hypotheses that the population means are equal (alternatively that the difference in population means is zero). Also, there are some post hoc details like pooled variance and multiple comparisons adjustments. We can set those aside, as they are largely irrelevant to your question.
By contrast, tests for equivalence (which could be, but are not necessarily post hoc tests following an ANOVA), have null hypotheses that the population means are different by at least some researcher-defined amount. You might get something out of reading the tost tag description.
One can combine the inferences from difference and equivalence tests, as I point out in my question here.
Best Answer
I saw your other post. Missing values due to expiration is often set to 0, see gomez & gomez (1984) - Statistical Procedures for Agricultural Research. This should make it a complete design and you should be able to use Type-1 to calculate the SS. If you disagree, just calculate it by hand, see Milliken (2009) - messy data analysis for details on how to calculate type-3 SS.
However, I think type-3 SS are nonsense but that is another diskussion, see type-4 for more intuitive testing!