Learn R Programming

refund (version 0.1-1)

lf: Construct an FLM regression term

Description

Defines a term $\int_{T}\beta(t)X_i(t)dt$ for inclusion in an mgcv::gam-formula (or bam or gamm or gamm4:::gamm) as constructed by fgam, where $\beta(t)$ is an unknown coefficient function and $X_i(t)$ is a functional predictor on the closed interval $T$. Defaults to a cubic B-spline with second-order difference penalties for estimating $\beta(t)$. The functional predictor must be fully observed on a regular grid.

Usage

lf(X, xind = seq(0, 1, l = ncol(X)), 
   integration = c("simpson", "trapezoidal", "riemann"), 
   L = NULL, 
   splinepars = list(bs = "ps", k= min(ceiling(n/4), 40), m = c(2, 2)), 
   presmooth = TRUE)

Arguments

X
an N by J=ncol(xind) matrix of function evaluations $X_i(t_{i1}),., X_i(t_{iJ}); i=1,.,N.$
xind
matrix (or vector) of indices of evaluations of $X_i(t)$; i.e. a matrix with ith row $(t_{i1},.,t_{iJ})$.
integration
method used for numerical integration. Defaults to "simpson"'s rule for calculating entries in L. Alternatively and for non-equidistant grids, "trapezoidal" or "riemann". "riemann" integrati
L
optional: an N by ncol(xind) matrix giving the weights for the numerical integration over t.
splinepars
optional arguments specifying options for representing and penalizing the functional coefficient $\beta(t)$. Defaults to a cubic B-spline with second-order difference penalties, i.e. list(bs="ps", m=c(2, 1)) See
presmooth
If true, the functional predictor is pre-smoothed prior to fitting. See smooth.basisPar in package fda

Value

  • a list with the following entries
  • calla "call" to te (or s, t2) using the appropriately constructed covariate and weight matrices.
  • xindthe xind argument supplied to lf.
  • Lthe matrix of weights used for the integration.
  • xindnamethe name used for the functional predictor variable in the formula used by mgcv.
  • tindnamethe name used for xind variable in the formula used by mgcv.
  • LXnamethe name used for the L variable in the formula used by mgcv.
  • presmooththe presmooth argument supplied to lf.
  • Xfdan fd object from presmoothing the functional predictors using smooth.basisPar. Only present if presmooth=TRUE. See fd.

See Also

fgam, af, mgcv's linear.functional.terms, fgam for examples.