Package 'mgcv'
mgcv.pdf page12 -page14
choose.k    Basis dimension choice for smooths
里面的说明及各种范例
已经说明的非常清楚
楼主看了,自当了然.
1. fit your model and extract the deviance residuals;
2. for each smooth term in your model, fit an equivalent, single, 
   smooth to the residuals, using a substantially increased k to 
   see if there is pattern in the residuals that could potentially 
   be explained by increasing k.
###########
## Simulate some data ....
library(mgcv)
set.seed(0)
dat <- gamSim(1,n=400,scale=2)
## fit a GAM with quite low 'k'
b<-gam(y~s(x0,k=6)+s(x1,k=6)+s(x2,k=6)+s(x3,k=6),data=dat)
plot(b,pages=1)
## Economical tactic (see below for more obvious approach)....
## check for residual pattern, removeable by increasing 'k'
## typically 'k', below, chould be substantially larger than
## the original, 'k' but certainly less than n/2.
## Note use of cheap "cs" shrinkage smoothers, and gamma=1.4
## to reduce chance of overfitting...
rsd <- residuals(b)
gam(rsd~s(x0,k=40,bs="cs"),gamma=1.4,data=dat) ## fine
gam(rsd~s(x1,k=40,bs="cs"),gamma=1.4,data=dat) ## fine
gam(rsd~s(x2,k=40,bs="cs"),gamma=1.4,data=dat) ## `k' too low
gam(rsd~s(x3,k=40,bs="cs"),gamma=1.4,data=dat) ## fine