SANtest: Example of simple additive GAM using penalized regression splines.
Description
Provides an example of the use of mgcv() and GAMsetup() for
simple GAM modelling with penalized regression splines. Truth is simulated as the sum of
3 univariate functions of 3 covariates: normal errors are added to produce simulated
data. A GAM is then fitted using mgcv() (including one spurious covariate).
Scatter plots of data against the 4 covariates and plots of true and reconstructed
functions are produced.
Of little interest for practical analysis (see gam instead).
Usage
SANtest(n=100, sig2=-1)
Arguments
n
n is the number of data to simulate.
sig2
The magnitude of sig2 gives the error variance to use for
simulation of data. If sig2 is greater than zero the UBRE is used with the error
variance, $\sigma^2$, given by sig2, otherwise GCV is used.
Value
An estimate of the error variance used for simulation (GCV), or the error variance
(UBRE).