Takes a vector and returns it with several attributes. The vector is used in
the construction of the model matrix. The function does no smoothing, but
assigns the attributes to the vector to aid gam in the smoothing.
USAGE:
s(x, df=4, spar=0)
REQUIRED ARGUMENTS:
x:
the univariate predictor, or expression, that evaluates to a numeric vector.
OPTIONAL ARGUMENTS:
df:
the target equivalent degrees of freedom, used as a smoothing parameter. The real smoothing parameter (spar below) is found such that df=tr(S)-1, where S is the implicit smoother matrix. Values for df should be greater than 1, with 1 implying a linear fit.
spar:
can be used as smoothing parameter, with values larger than 0.
VALUE:
the vector x is returned, endowed with a number of attributes.
The vector itself is used in the construction of the model matrix,
while the attributes are needed for the backfitting algorithms
all.wam or s.wam (weighted additive model).
Since smoothing splines reproduces linear fits,
the linear part will be efficiently computed with the
other parametric linear parts of the model.
DETAILS:
Note that s itself does no smoothing; it simply sets things up for gam.
# fit Start using a smoothing spline with 4 df.
y ~ Age + s(Start, 4)
# fit log(Start) using a smoothing spline with 5 df.
y ~ Age + s(log(Start), df=5)