SANtest {mgcv} | R Documentation |
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).
SANtest(n=100, sig2=-1)
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. |
An estimate of the error variance used for simulation (GCV), or the error variance (UBRE).
Simon N. Wood snw@st-and.ac.uk
set.seed(0) SANtest(300,-1) # use GCV with 300 data point example, variance 1 SANtest(300,0.5) # use UBRE 300 data, variance 0.5