optim or nlm.
Not normally called directly, but rather service routines for gam.outer.gam2objective(lsp,args,...)
gam2derivative(lsp,args,...)gam.fit3.gam.fit3.gam2objective and gam2derivative are functions suitable
for calling by optim, to evaluate the GCV/UBRE/AIC score and its
derivatives w.r.t. log smoothing parameters.gam4objective is an equivalent to gam2objective, suitable for
optimization by nlm - derivatives of the GCV/UBRE/AIC function are
calculated and returned as attributes.
The basic idea of optimizing smoothing parameters `outer' to the P-IRLS loop was first proposed in O'Sullivan et al. (1986).
O 'Sullivan, Yandall & Raynor (1986) Automatic smoothing of regression functions in generalized linear models. J. Amer. Statist. Assoc. 81:96-103.
Wood, S.N. (2008) Fast stable direct fitting and smoothness selection for generalized additive models. J.R.Statist.Soc.B 70(3):495-518
gam.fit3, gam, magic