funcreg: Linear Functional Regression

Description Usage Arguments Value References Examples

Description

Estimation of the functional parameters in a multiple functional regression. The smoothing parameters and the number of basis is assumed to be known.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
funcreg(form, create_basis=create.bspline.basis, LD=2, lambda,
                    k, regularized=TRUE, CstInt=FALSE, CV=FALSE, data=NULL,
                    alpha=1e-5, optAlpha=FALSE,
                    controlAlpha=list(), ...)

## S3 method for class 'funcreg'
print(x, ...)

## S3 method for class 'funcreg'
summary(object, ...)

## S3 method for class 'funcreg'
fitted(object, ...)

## S3 method for class 'funcreg'
residuals(object, ...)

Arguments

x

An object of class "funcreg"

object

An object of class "funcreg"

form

A formula for the functional regression. Arguments are objects of class "myfda" obtained either by coefEst or nlCoefEst, and must be in the local environment.

create_basis

The function used to create the basis object (see create.bspline.basis) for the functional parameters.

LD

Either a nonnegative integer defining an order of a derivative or a linear differential operator (see eval.penalty).

lambda

A vector of regularization parameters that penalizes for the absence of smoothness. The dimention is 2 times the number of regressors plus 1 if there is an intercept and if CstInt=FALSE. The first is for the intercept, the second and third for the first regressor and so on. If it is a scalar, it is assumed that the smoothing parameter is the same for all functional parameters.

k

A vector of integers representing the number of basis for each functional parameter. The first is for the intercept (if there is an intercept and that Cstint=FALSE), the second for the first functional parameter and so on. If it is a scalar, it is assumed that the number of basis is the same for all functional parameters.

regularized

If TRUE, the system is regularized by add alpha to the main diagonal of the regression matrix

CstInt

If TRUE, the intercept is assumed constant. If FALSE, it is a one dimensional functional parameter.

CV

if TRUE, it computes the cross-validation.

data

An optional list of myfda objects, which are the functional data included in the formula form

alpha

The regularization parameter. The value is added to the diagonal of the regression matrix to make sure it is positive definite.

optAlpha

If TRUE, the regularization parameter is the one that minimizes the cross-validation using the Brent method

controlAlpha

A list of tuning parameter for the choice of the optimal alpha. The default parameters are maxit=100 , tol=1e-5, and intAlpha=c(1e-11, 1e-4).

...

For funcreg, it is other argument that is passed to create_basis (see create.bspline.basis). For the methods, it is the other arguments to pass to other objects.

Value

It returns an object of 'class' "funcreg"

The object of class "funcreg" is a list containing at least:

X

The list of functional regressors.

Y

The functional response.

data

A list with element "t" for time units of the observed data and "Y" for the matrix of observed response varable.

References

Ramsay, James O., & Silverman, Bernard W. (2005), Functional Data Analysis, Springer, New York.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
data(GDPv56) 

## We just create response and a covariate artificialy from the GDP
## series

y <- GDPv56[,1:30]
x <- GDPv56[,31:60]
t <- seq(0,1,len=nrow(y))

## First we create the "myfda" objects
yfd <- coefEst(y, t, .0004, 15, 2)
xfd <- coefEst(x, t, .0004, 15, 2)


## we just set lambda and k to arbitrary values
res <- funcreg(yfd~xfd, k=c(5,5), lambda=c(.001,.001,.001))
res

summary(res)

plot(fitted(res))

plot(residuals(res))

## Getting the optimal regularization parameter
res <- funcreg(yfd~xfd, k=c(5,5), lambda=c(.001,.001,.001),
               optAlpha=TRUE)
res

funcreg documentation built on May 2, 2019, 5:45 p.m.

Related to funcreg in funcreg...