gpfr: Gaussian process functional regression (GPFR) model

View source: R/gpfr.functions6.R

gpfrR Documentation

Gaussian process functional regression (GPFR) model

Description

Use functional regression (FR) model for the mean structure and Gaussian Process (GP) for the covariance structure.

Let 'n' be the number of time points 't' of functional objects and 'nrep' the number of independent replications in the sample.

Usage

gpfr(
  response,
  time = NULL,
  uReg = NULL,
  fxReg = NULL,
  fyList = NULL,
  uCoefList = NULL,
  fxList = NULL,
  concurrent = TRUE,
  fxCoefList = NULL,
  gpReg = NULL,
  hyper = NULL,
  NewHyper = NULL,
  Cov = "pow.ex",
  gamma = 2,
  nu = 1.5,
  useGradient = T,
  rel.tol = 1e-10,
  trace.iter = 5,
  fitting = FALSE
)

Arguments

response

Response data. It can be an 'fd' object or a matrix with 'nrep' rows and 'n' columns.

time

Input 't' of functional objects. It is a numeric vector of length 'n'.

uReg

Scalar covariates for the FR model. It should be a matrix with 'nrep' rows.

fxReg

Functional covariates for the FR model. It can be a matrix with 'nrep' rows and 'n' columns, an 'fd' object, or a list of matrices or 'fd' objects.

fyList

A list to control the smoothing of response.

uCoefList

A list to control the smoothing of the regression coefficient function of the scalar covariates in the FR model.

fxList

A list to control the smoothing of functional covariates in the FR model.

concurrent

Logical. If TRUE (default), concurrent functional regression will be carried out; otherwise, the full functional regression will be carried out.

fxCoefList

A list to control the smoothing of the regression coefficient function of functional covariates in the functional concurrent model.

gpReg

Covariates in the GP model. It should be a matrix, a numeric vector, an 'fd' object, a list of matrices or a list of 'fd' objects.

hyper

Vector of initial hyperparameters. Default to NULL.

NewHyper

Vector of names of new hyperparameters from the customized kernel function.

Cov

Covariance function(s) to use. Options are: 'linear', 'pow.ex', 'rat.qu', and 'matern'. Default to 'power.ex'.

gamma

Power parameter used in powered exponential kernel function. It must be 0<gamma<=2.

nu

Smoothness parameter of the Matern class. It must be a positive value.

useGradient

Logical. If TRUE, first derivatives will be used in the optimization.

rel.tol

Relative tolerance passed to nlminb(). Default to be 1e-10.

trace.iter

Print the processing of iterations of optimization.

fitting

Logical. If TRUE, fitting is carried out. Default to FALSE.

Details

fyList is a list with the following items:

  • time: a sequence of time points; default to be 100 points from 0 to 1.

  • nbasis: number of basis functions used in smoothing, default to be less than or equal to 23.

  • norder: order of the functional curves; default to be 6.

  • bSpline: logical. If TRUE (default), B-splines basis is used; otherwise, Fourier basis is used.

  • Pen: default to be c(0,0), meaning that the penalty is only applied to the second order derivative of the curve, with no penalty for the zero-th and first order derivatives of the curve.

  • lambda: smoothing parameter for the penalty, default to be 1e-4.

fxList is similar to fyList. However, it is a list of lists to allow for different specifications for each functional covariate if there are multiple ones.

uCoefList and fxCoefList are similar to each other. Each one is expected to be a list of lists. If a list of one element is provided, then the items of this element are applied to each of the functional coefficients of scalar covariates and of functional covariates, respectively.

  • rtime: range of time, default to be c(0,1).

  • nbasis: nnumber of basis functions used in smoothing, default to be less than or equal to 19.

  • norder: order of the functional curves; default to be 6.

  • bSpline: logical. If TRUE (default), B-splines basis is used; otherwise, Fourier basis is used.

  • Pen: default to be c(0,0).

  • lambda: smoothing parameter for the penalty, default to be 1e4.

  • bivar:logical. Used for non-concurrent models; if TRUE, bivariate basis will be used; if FALSE (default), normal basis will be used; see details in bifdPar.

  • lambdas: smoothing parameter for the penalty of the additional basis, default to be 1.

Note that all items have default settings.

Value

A list containing:

hyper

Estimated hyperparameters

I

A vector of estimated standard deviation of hyperparameters

modellist

List of FR models fitted before Gaussian process

CovFun

Covariance function used

gamma

Parameter 'gamma' used in Gaussian process with powered exponential kernel

nu

Parameter 'nu' used in Gaussian process with Matern kernel

init_resp

Raw response data

resid_resp

Residual after the fitted values from FR models have been taken out

fitted

Fitted values

fitted.sd

Standard deviation of the fitted values

ModelType

The type of the model applied in the function.

lTrain

Training scalar covariates for the FR model

fTrain

Training functional covariates for the FR model

mfTrainfd

List of 'fd' objects from training data for FR model with functional covariates

gpTrain

Training data for Gaussian Process

time

Input time 't'

iuuL

Inverse of covariance matrix for uReg

iuuF

Inverse of covariance matrix for fxReg

fittedFM

Fitted values from the FR model

fyList

fyList object used

References

  • Ramsay, J., and Silverman, B. W. (2006), “Functional Data Analysis”, 2nd ed., Springer, New York.

  • Shi, J. Q., and Choi, T. (2011), “Gaussian Process Regression Analysis for Functional Data”, CRC Press.

Examples

## See examples in vignette:
# vignette("gpfr", package = "GPFDA")

GPFDA documentation built on Sept. 11, 2023, 1:08 a.m.