fregre.basis.fr: Functional Regression with functional response using basis...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/fregre.basis.fr.r

Description

Computes functional regression between functional explanatory variable X(s) and functional response Y(t) using basis representation.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
fregre.basis.fr(
  x,
  y,
  basis.s = NULL,
  basis.t = NULL,
  lambda.s = 0,
  lambda.t = 0,
  Lfdobj.s = vec2Lfd(c(0, 0), range.s),
  Lfdobj.t = vec2Lfd(c(0, 0), range.t),
  weights = NULL,
  ...
)

Arguments

x

Functional explanatory variable.

y

Functional response variable.

basis.s

Basis related with s and it is used in the estimation of β(s,t).

basis.t

Basis related with t and it is used in the estimation of β(s,t).

lambda.s

A roughness penalty with respect to s to be applied in the estimation of β(s,t). By default, no penalty lambda.s=0.

lambda.t

A roughness penalty with respect to t to be applied in the estimation of β(s,t). By default, no penalty lambda.t=0.

Lfdobj.s

A linear differential operator object with respect to s . See eval.penalty.

Lfdobj.t

A linear differential operator object with respect to t. See eval.penalty.

weights

Weights.

...

Further arguments passed to or from other methods.

Details

Y=α(t)+\int X(s)β(s,t)ds+ε(t)

where α(t) is the intercept function, β(s,t) is the bivariate resgression function and ε(t) are the error term with mean zero.

The function is a wrapped of linmod function proposed by Ramsay and Silverman (2005) to model the relationship between the functional response Y(t) and the functional covariate X(t) by basis representation of both.

The unknown bivariate functional parameter β(s,t) can be expressed as a double expansion in terms of K basis function ν_k and L basis functions θ_l,

β(s,t)=∑_k ∑_l b_{kl} ν_k(s)θ_l(t)=ν(s)'Bθ(t)

Then, the model can be re–written in a matrix version as,

Y(t)=α(t)+\int X(s)ν(s)'Bθ(t)ds+ε(t)=α(t)+XBθ(t)+ε(t)

where X=\int X(s)ν'(t)ds

This function allows objects of class fdata or directly covariates of class fd. If x is a fdata class, basis.s is also the basis used to represent x as fd class object. If y is a fdata class, basis.t is also the basis used to represent y as fd class object. The function also gives default values to arguments basis.s and basis.t for construct the bifd class object used in the estimation of β(s,t). If basis.s=NULL or basis.t=NULL the function creates a bspline basis by create.bspline.basis.

fregre.basis.fr incorporates a roughness penalty using an appropiate linear differential operator; lambda.s,Lfdobj.s for penalization of β's variations with respect to s and
lambda.t,Lfdobj.t for penalization of β's variations with respect to t.

Value

Return:

Author(s)

Manuel Febrero-Bande, Manuel Oviedo de la Fuente manuel.oviedo@usc.es

References

Ramsay, James O., and Silverman, Bernard W. (2006), Functional Data Analysis, 2nd ed., Springer, New York.

See Also

See Also as: predict.fregre.fr. Alternative method: linmod.

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
29
30
31
32
33
34
35
36
37
38
39
40
41
## Not run: 
rtt<-c(0, 365)
basis.alpha  <- create.constant.basis(rtt)
basisx  <- create.bspline.basis(rtt,11)
basisy  <- create.bspline.basis(rtt,11)
basiss  <- create.bspline.basis(rtt,7)
basist  <- create.bspline.basis(rtt,9)

# fd class
dayfd<-Data2fd(day.5,CanadianWeather$dailyAv,basisx)
tempfd<-dayfd[,1]
log10precfd<-dayfd[,3]
res1 <-  fregre.basis.fr(tempfd, log10precfd,
basis.s=basiss,basis.t=basist)

# fdata class
tt<-1:365
tempfdata<-fdata(t(CanadianWeather$dailyAv[,,1]),tt,rtt)
log10precfdata<-fdata(t(CanadianWeather$dailyAv[,,3]),tt,rtt)
res2<-fregre.basis.fr(tempfdata,log10precfdata,
basis.s=basiss,basis.t=basist)

# penalization
Lfdobjt <- Lfdobjs <- vec2Lfd(c(0,0), rtt)
Lfdobjt <- vec2Lfd(c(0,0), rtt)
lambdat<-lambdas <- 100
res1.pen <- fregre.basis.fr(tempfdata,log10precfdata,basis.s=basiss,
basis.t=basist,lambda.s=lambdas,lambda.t=lambdat,
Lfdobj.s=Lfdobjs,Lfdobj.t=Lfdobjt)

res2.pen <- fregre.basis.fr(tempfd, log10precfd,
basis.s=basiss,basis.t=basist,lambda.s=lambdas,
lambda.t=lambdat,Lfdobj.s=Lfdobjs,Lfdobj.t=Lfdobjt)

plot(log10precfd,col=1)
lines(res1$fitted.values,col=2)
plot(res1$residuals)
plot(res1$beta.est,tt,tt)
plot(res1$beta.est,tt,tt,type="persp",theta=45,phi=30)

## End(Not run)

Example output

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
----------------------------------------------------------------------------------

[1] "done"
[1] "done"

fda.usc documentation built on Feb. 18, 2020, 1:07 a.m.