Use buildmer to fit big generalized additive models using gamm from package mgcv
buildmer
gamm
mgcv
Useful links