I tested the effect of one factor X on my response Y. The factor has four levels A, B, C, and D and the null hypothesis I want to test is A=B=C=D.
# my dataset
mydata = data.frame(res=c(5,3,1,2,5,2,6,2),fac = c("A","A","B","B","C","C","D","D"))
# 1. using ANOVA
anova(lm(mydata$res~mydata$fac))
# output
Analysis of Variance Table
Response: mydata$res
Df Sum Sq Mean Sq F value Pr(>F)
mydata$fac 3 8.5 2.8333 0.7556 0.5742
Residuals 4 15.0 3.7500
# 2. using Wald test
library("aod")
lr = summary(lm(mydata$res~mydata$fac))
wald.test(Sigma = (lr$cov.unscaled), b= (lr$coefficients)[,1], Terms = 2:4)
# output
Wald test:
----------
Chi-squared test:
X2 = 8.5, df = 3, P(> X2) = 0.037
As you can see, although both test the same null hypothesis, the p-value from ANOVA is 0.5742 while the p-value from the wald test is 0.037. I am not sure if my calculation process is correct.