# Comparing different GAMs using AIC when the models were fitted using "method=REML" in mgcv

I am new to GAM and comparing several subsets of these model from the same data(multiple covariates). Now if I set the "method" to "REML" and then compare their AIC values, would that be pointless? Also if I further want to compare the p-values of them what should be an appropriate method? I know ML is biased but since the pvalues for gam give less valid result for the method gcv relative to reml/ml, so should I use ML method as a whole? Sorry for my ignorance!

If you need to do model selection, I would look at the select argument or shrinkage smooths (bs = "ts" or bs = "cs") to implement selection via additional penalties, rather than comparing models via AIC.
However, when using REML smoothing selection, at least according to my reading of ?logLik.gam, the AIC is using the penalized maximum likelihood estimates regardless of whether smoothness selection is done using ML or REML. So the general problem of comparing models using likelihoods from models fitted using REML doesn't seem to apply to GAMs fitted by {mgcv}. This is because {mgcv} is using the conditional AIC which involves the likelihood of the model estimates at their penalized MLEs plus a correction for smoothness selection.