Learn R Programming

refund (version 0.1-5)

ff: Construct a function-on-function regression term

Description

Defines a term $\int^{s_{hi, i}}_{s_{lo, i}} X_i(s)\beta(t,s)ds$ for inclusion in an mgcv::gam-formula (or bam or gamm or gamm4:::gamm) as constructed by pffr. Defaults to a cubic tensor product B-spline with marginal first difference penalties for $\beta(t,s)$ and integration over the entire range $[s_{lo, i}, s_{hi, i}] = [\min(s_i), \max(s_i)]$. Can't deal with any missing $X(s)$, unequal lengths of $X_i(s)$ not (yet?) possible. Unequal ranges for different $X_i(s)$ should work. $X_i(s)$ is assumed to be numeric.

Usage

ff(X, yind, xind = seq(0, 1, l = ncol(X)), basistype =
  c("te", "t2", "s"), integration = c("simpson",
  "trapezoidal"), L = NULL, limits = NULL, splinepars =
  list(bs = "ps", m = c(2, 1)))

Arguments

X
an n by ncol(xind) matrix of function evaluations $X_i(s_{i1}),\dots, X_i(s_{iS})$; $i=1,\dots,n$.
yind
matrix (or vector) of indices of evaluations of $Y_i(t)$
xind
matrix (or vector) of indices of evaluations of $X_i(s)$; i.e. matrix with rows $(s_{i1},\dots,s_{iS})$
basistype
defaults to "te", i.e. a tensor product spline to represent $\beta(t,s)$. Alternatively, use "s" for bivariate basis functions (see mgcv's
integration
method used for numerical integration. Defaults to "simpson"'s rule for calculating entries in L. Alternatively and for non-equidistant grids, "trapezoidal".
L
optional: an n by ncol(xind) matrix giving the weights for the numerical integration over $s$.
limits
(NOT YET IMPLEMENTED)
splinepars
optional arguments supplied to the basistype-term. Defaults to a cubic tensor product B-spline with marginal first difference penalties, i.e. list(bs="ps", m=c(2, 1)) See te

Value

  • a list containing
    • calla "call" tote(ors,t2) using the appropriately constructed covariate and weight matrices
    • dataa list containing the necessary covariate and weight matrices

See Also

mgcv's linear.functional.terms