refund (version 0.1-23)

pffrGLS: Penalized function-on-function regression with non-i.i.d. residuals


Implements additive regression for functional and scalar covariates and functional responses. This function is a wrapper for mgcv's gam and its siblings to fit models of the general form \(Y_i(t) = \mu(t) + \int X_i(s)\beta(s,t)ds + f(z_{1i}, t) + f(z_{2i}) + z_{3i} \beta_3(t) + \dots + E_i(t))\) with a functional (but not necessarily continuous) response \(Y(t)\), (optional) smooth intercept \(\mu(t)\), (multiple) functional covariates \(X(t)\) and scalar covariates \(z_1\), \(z_2\), etc. The residual functions \(E_i(t) \sim GP(0, K(t,t'))\) are assumed to be i.i.d. realizations of a Gaussian process. An estimate of the covariance operator \(K(t,t')\) evaluated on yind has to be supplied in the hatSigma-argument.


  algorithm = NA,
  method = "REML",
  tensortype = c("te", "t2"),
  bs.yindex = list(bs = "ps", k = 5, m = c(2, 1)), = list(bs = "ps", k = 20, m = c(2, 1)),
  cond.cutoff = 500,



a formula with special terms as for gam, with additional special terms ff() and c(). See pffr.


a vector with length equal to the number of columns of the matrix of functional responses giving the vector of evaluation points \((t_1, \dots ,t_{G})\). see pffr


(an estimate of) the within-observation covariance (along the responses' index), evaluated at yind. See Details.


the name of the function used to estimate the model. Defaults to gam if the matrix of functional responses has less than 2e5 data points and to bam if not. "gamm" (see gamm) and "gamm4" (see gamm4) are valid options as well.


See pffr


See pffr


See pffr

See pffr


if the condition number of hatSigma is greater than this, hatSigma is made ``more'' positive-definite via nearPD to ensure a condition number equal to cond.cutoff. Defaults to 500.


additional arguments that are valid for gam or bam. See pffr.


a fitted pffr-object, see pffr.


Note that hatSigma has to be positive definite. If hatSigma is close to positive semi-definite or badly conditioned, estimated standard errors become unstable (typically much too small). pffrGLS will try to diagnose this and issue a warning. The danger is especially big if the number of functional observations is smaller than the number of gridpoints (i.e, length(yind)), since the raw covariance estimate will not have full rank. Please see pffr for details on model specification and implementation. THIS IS AN EXPERIMENTAL VERSION AND NOT WELL TESTED YET -- USE AT YOUR OWN RISK.

See Also