I'm trying to use gam in MGCV to automatically select my level of smoothness using cross validation or some equivalent method for my generalized additive model. reading around online it looks like REML will get the job done (although any advice on interpretation would be appreciated) and i'm just playing with data from the ISLR library, specifically "Wage". here are my calls:
myWageGam= gam(wage~s(year ,4)+s(age ,5)+education ,data=Wage) myWageGam1= mgcv::gam(wage~s(year ,4)+s(age ,5)+education ,data=Wage, method = "REML")
this is what i'm doing, but although the first function call (i think from the gam library) works the second doesn't and I get the following error: Error in as.matrix(x) : object 'year' not found
any idea what going on and if REML is the best way to get an estimated test error? Thanks!