smooth.construct.pi.smooth.spec {refund} | R Documentation |
Parametric Interaction basis constructor
Description
The pi
basis is appropriate for smooths of multiple variables. Its
purpose is to parameterize the way in which the basis changes with one of
those variables. For example, suppose the smooth is over three variables,
,
, and
, and we want to parameterize the effect of
. Then the
pi
basis will assume , where the
functions are pre-specified and the
functions are estimated using a bivariate basis. An example of
a parametric interaction is a linear interaction, which would take the form
.
Usage
## S3 method for class 'pi.smooth.spec'
smooth.construct(object, data, knots)
Arguments
object |
a smooth specification object, generated by, e.g.,
|
data |
a list containing the variables of the smooth ( |
knots |
a list containing any knots supplied for basis setup - in same
order and with same names as |
Details
All functions are defined using the same basis set.
Accordingly, they are penalized using a single block-diagonal penalty matrix
and one smoothing parameter. Future versions of this function may be able
to relax this assumption.
object
should be defined (using s()
) with an xt
argument. This argument is a list that could contain any of the following
elements:
-
g
: the functions, specified as described below.
-
bs
: the basis code used for the functions; defaults to thin-plate regression splines, which is mgcv's default. The same basis will be used for all
.
-
idx
: an integer index indicating which variable fromobject$term
is to be parameterized, i.e., thevariable; defaults to
length(object$term)
-
mp
: flag to indicate whether multiple penalties should be estimated, one for each. Defaults to
TRUE
. IfFALSE
, the penalties for eachare combined into a single block-diagonal penalty matrix (with one smoothing parameter).
-
...
: furtherxt
options to be passed onto the basis for.
xt$g
can be entered in one of the following forms:
a list of functions of length
, where each function is of one argument (assumed to be
)
one of the following recognized character strings:
"linear"
, indicating a linear interaction, i.e.;
"quadratic"
, indicating a quadratic interaction, i.e.; or
"none"
, indicating no interaction with, i.e.
.
The only one of the above elements that is required is xt
.
If default values for bs
, idx
, and mp
are desired,
xt
may also be entered as the g
element itself; i.e.
xt=g
, where g
is either the list of functions or an acceptable
character string.
Additional arguments for the lower-dimensional basis over f_k
may
be entered using the corresponding arguments of s()
, e.g.
k
, m
, sp
, etc. For example,
s(x, t, bs="pi", k=15, xt=list(g="linear", bs="ps"))
will define a linear interaction with t
of a univariate p-spline
basis of dimension 15 over x
.
Value
An object of class "pi.smooth". See
smooth.construct
for the elements it will contain.
Author(s)
Fabian Scheipl and Jonathan Gellar