[R] Comparing two GAMs using anova (mgcv)

Lucas Holland hollandlucas at gmail.com
Fri Sep 20 13:37:05 CEST 2013


Hey all,

I've fitted two GAMs to some data using mgcv. The only difference between the two models is that one includes an additional smooth term (the smooth terms are s(x), s(y) and s(log(y)), the difference being that one model contains s(y) as additional term whereas the other one only contains s(x) and s(log(y)) - x and y being my explanatory variables). 

I'm now trying to decide between those two models. There's no difference in deviance explained or R^2 and the diagnostic plots returned by gam.check() look fairly similar although the one of the fuller model looks slightly more satisfactory as far as the histogram of the residuals is concerned. 

I'm wondering whether it is appropriate to conduct an approximate F test using the anova function. I'm not 100% clear I've understood the documentation on that completely. Is it appropriate to conduct such a test if the only difference between models is the inclusion/exclusion of a smooth term? 

Conducting the test, I get the result that there's no reason to reject the null hypothesis that the simpler model (without s(y)) is correct. 

Thanks!



More information about the R-help mailing list