Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

lf_old

Construct an FLM regression term


Description

Defines a term \int_{T}β(t)X_i(t)dt for inclusion in an gam-formula (or bam or gamm or gamm4) as constructed by fgam, where β(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 β(t). The functional predictor must be fully observed on a regular grid.

Usage

lf_old(
  X,
  argvals = seq(0, 1, l = ncol(X)),
  xind = NULL,
  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(argvals) matrix of function evaluations X_i(t_{i1}),., X_i(t_{iJ}); i=1,.,N.

argvals

matrix (or vector) of indices of evaluations of X_i(t); i.e. a matrix with ith row (t_{i1},.,t_{iJ})

xind

same as argvals. It will not be supported in the next version of refund.

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" integration is always used if L is specified

L

an optional N by ncol(argvals) matrix giving the weights for the numerical integration over t

splinepars

optional arguments specifying options for representing and penalizing the functional coefficient β(t). Defaults to a cubic B-spline with second-order difference penalties, i.e. list(bs="ps", m=c(2, 1)) See te or s for details

presmooth

logical; if true, the functional predictor is pre-smoothed prior to fitting. See smooth.basisPar

Value

a list with the following entries

  1. call - a call to te (or s, t2) using the appropriately constructed covariate and weight matrices

  2. argvals - the argvals argument supplied to lf

  3. L - the matrix of weights used for the integration

  4. xindname - the name used for the functional predictor variable in the formula used by mgcv

  5. tindname - the name used for argvals variable in the formula used by mgcv

  6. LXname - the name used for the L variable in the formula used by mgcv

  7. presmooth - the presmooth argument supplied to lf

  8. Xfd - an fd object from presmoothing the functional predictors using smooth.basisPar. Only present if presmooth=TRUE. See fd

Author(s)

Mathew W. McLean mathew.w.mclean@gmail.com and Fabian Scheipl

See Also

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


refund

Regression with Functional Data

v0.1-23
GPL (>= 2)
Authors
Jeff Goldsmith [aut], Fabian Scheipl [aut], Lei Huang [aut], Julia Wrobel [aut, cre], Chongzhi Di [aut], Jonathan Gellar [aut], Jaroslaw Harezlak [aut], Mathew W. McLean [aut], Bruce Swihart [aut], Luo Xiao [aut], Ciprian Crainiceanu [aut], Philip T. Reiss [aut], Yakuan Chen [ctb], Sonja Greven [ctb], Lan Huo [ctb], Madan Gopal Kundu [ctb], So Young Park [ctb], David L. Miller [ctb], Ana-Maria Staicu [ctb]
Initial release
2020-12-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.