# What tests effectively compare a random effects model and a fixed effects model in R?

I am looking for a way to compare two models (I am not very good at R or statistics). The only difference between the two is that one has fixed effects and the other has random effects. Let me know what you would do to compare them!

fixedmodel <- plm(mrateunder5 ~ GDPPPP, index = c("Year",
"Country"), model = "within", data = FinalData)

randommodel <- plm(mrateunder5 ~ GDPPPP, index = c("Year",
"Country"), model = "within", data = FinalData)


What tests would I use to compare these two models?

Things I tried but am not sure about:

BIC(lm(mrateunder5 ~1))
BIC(fixedmodel)
BIC(randommodel)


and got

[1] 755.3131
[1] 694.2637
[1] 700.9067


The difference between BIC(fixedmodel) and BIC(randommodel) is not large enough to make a conclusion on which is more effective, correct?

I saw someone suggested the Wald Test for each, but I am not sure how to interpret the results.

This is what I did:

pwaldtest(fixedmodel, test = "Chisq")
pwaldtest(randommodel, test = "Chisq")



Results:

    Wald test for joint significance

data:  mrateunder5 ~ GDPPPP
Chisq = 67.795, df = 1, p-value < 2.2e-16
alternative hypothesis: at least one coefficient is not null

Wald test for joint significance

data:  mrateunder5 ~ GDPPPP
Chisq = 71.103, df = 1, p-value < 2.2e-16
alternative hypothesis: at least one coefficient is not null



Also, can I use the likelihood ratio test to compare the models? I would assume not because I think plm is OLS not MLE, but I'm not sure.

p.s. The random effects model has a slightly higher adjusted r-squared, but my professor told us that adjusted r-squared says enough about the models to make a comparison.

It is a bit suprising this question is asked as (almost?) all textbooks on panel data econometrics introduce the Hausman test (Hausman (1978)) as the standard test to discriminate between the fixed effects and random effects specification early on.

Also the plm package's first vignette [1] introduces this test; it is implemented in phtest. Picking up the example from there:

library(plm)
data("Grunfeld", package = "plm")
gw <- plm(inv~value+capital, data=Grunfeld, model="within")
gr <- plm(inv~value+capital, data=Grunfeld, model="random")
phtest(gw, gr)
##
##  Hausman Test
##
## data:  inv ~ value + capital
## chisq = 2.3304, df = 2, p-value = 0.3119
## alternative hypothesis: one model is inconsistent


The package also supports the auxiliary-regression-based version of the Hausman test (e.g., Wooldridge (2010) Sec.10.7.3) by using the formula interface and setting argument test = "aux". It can be robustified by specifying a robust covariance estimator as a function through the argument vcov:

phtest(inv ~ value + capital, data = Grunfeld, method = "aux", vcov = vcovHC)
##
##  Regression-based Hausman test, vcov: vcovHC
##
## data:  inv ~ value + capital
## chisq = 8.2998, df = 2, p-value = 0.01577
## alternative hypothesis: one model is inconsistent