[R] Comparing two GAMs using anova (mgcv)

Simon Wood s.wood at bath.ac.uk
Mon Sep 23 09:43:06 CEST 2013


It's ok to use an approximate F test here, provided you are careful with 
the interpretation. e.g. do look at the differences in EDF and not just 
the p-value (negative or very small EDF differences will render the 
p-value essentially meaningless). however...

Where-ever possible it is usually better to test using `summary' or 
`anova' with a single model argument. The approximations used by these 
are better founded than the approximate F-test. i.e. take a look at the 
p-values associated with the 's(y)' term in the larger model.

best,
Simon

On 20/09/13 13:37, Lucas Holland wrote:
> 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!
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Simon Wood, Mathematical Science, University of Bath BA2 7AY UK
+44 (0)1225 386603               http://people.bath.ac.uk/sw283



More information about the R-help mailing list