Solved – How to compare GLS models

aicgeneralized-least-squaresrregressionspatial

I have spatial data set for 35 studies. In each study, there are variables y, x1, x2, latitude, and longitude. I want to know whether adding x2 to model y~x1 will improve the simple regression model y~x1.

I use m_study1 = gls(y ~ x1 + x2, data=study1, correlation=corExp(form=~Lat+Long)) for each study. I also use m_study1_x1 = gls(y ~ x1, data=study1, correlation=corExp(form=~Lat+Long)). I used AIC to compare two models and got an error "models are not all fitted to the same number of observations". I think that is because of different df in two models. What should I do? How can I tell whether adding x2 will improve predicting y? Thx.

Best Answer

Why the number of observations change? You are using the same dataset (study1).

It may because the use of REML...

In addition to the ANOVA cited above, you can try the model.sel function from MuMIn package, which rank by AICc(an AIC corrected for smaller samples, it's safer). You could also change the correlation structures, gaussian, spherical, and check which one gives the lower AICc.