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,
\(x\), \(y\), and \(t\), and we want to parameterize the effect of
\(t\). Then the
pi basis will assume \(f(x,y,t) = \sum_k
g_k(t)*f_k(x,y)\), where the \(g_k(t)\) functions are pre-specified and the
\(f_k(x,y)\) functions are estimated using a bivariate basis. An example of
a parametric interaction is a linear interaction, which would take the form
\(f(x,y,t) = f_1(x,y) + t*f_2(x,y)\).
# S3 method for pi.smooth.spec smooth.construct(object, data, knots)
a smooth specification object, generated by, e.g.,
s(x, y, t, bs="pi", xt=list(g=list(g1, g2, g3))). For
a list containing the variables of the smooth (
t above), as well as any
a list containing any knots supplied for basis setup - in same
order and with same names as
data. Can be
An object of class "pi.smooth". See
smooth.construct for the elements it will contain.
All functions \(f_k()\) 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
argument. This argument is a list that could contain any of the following
g: the functions \(g_k(t)\), specified as described below.
bs: the basis code used for the functions \(f_k()\); defaults
to thin-plate regression splines, which is mgcv's default. The same
basis will be used for all \(k\).
idx: an integer index indicating which variable from
object$term is to be parameterized, i.e., the \(t\) variable;
mp: flag to indicate whether multiple penalties should
be estimated, one for each \(f_k()\). Defaults to
FALSE, the penalties for each \(k\) are combined into a single
block-diagonal penalty matrix (with one smoothing parameter).
xt 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 \(k\), where each function is of one argument (assumed to be \(t\))
one of the following recognized character strings: code"linear",
indicating a linear interaction, i.e. \(f(x,t) = f_1(x)+t*f_2(x)\);
"quadratic", indicating a quadratic interaction, i.e.
\(f(x,t) = f_1(x)+t*f_2(x) + t^2*f_3(x)\); or
"none", indicating no interaction with \(t\), i.e.
The only one of the above elements that is required is
If default values for
mp are desired,
xt may also be entered as the
g element itself; i.e.
g is either the list of functions or an acceptable
Additional arguments for the lower-dimensional basis over
be entered using the corresponding arguments of
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