gpfr: Gaussian process functional regression (GPFR) model

Description Usage Arguments Details Value References Examples

View source: R/gpfr.functions6.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
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:

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.

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

Examples

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

Example output

Loading required package: fda.usc
Loading required package: fda
Loading required package: splines
Loading required package: Matrix
Loading required package: fds
Loading required package: rainbow
Loading required package: MASS
Loading required package: pcaPP
Loading required package: RCurl

Attaching package:fdaThe following object is masked frompackage:graphics:

    matplot

Loading required package: mgcv
Loading required package: nlme
This is mgcv 1.8-33. For overview type 'help("mgcv-package")'.
----------------------------------------------------------------------------------
 Functional Data Analysis and Utilities for Statistical Computing
 fda.usc version 2.0.2 (built on 2020-02-17) is now loaded
 fda.usc is running sequentially usign foreach package
 Please, execute ops.fda.usc() once to run in local parallel mode
 Deprecated functions: min.basis, min.np, anova.hetero, anova.onefactor, anova.RPm
 New functions: optim.basis, optim.np, fanova.hetero, fanova.onefactor, fanova.RPm
----------------------------------------------------------------------------------

Loading required package: spam
Loading required package: dotCall64
Loading required package: grid
Spam version 2.5-1 (2019-12-12) is loaded.
Type 'help( Spam)' or 'demo( spam)' for a short introduction 
and overview of this package.
Help for individual functions is also obtained by adding the
suffix '.spam' to the function name, e.g. 'help( chol.spam)'.

Attaching package:spamThe following object is masked frompackage:Matrix:

    det

The following objects are masked frompackage:base:

    backsolve, forwardsolve

GPFDA documentation built on Jan. 29, 2021, 5:14 p.m.