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

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

fregre.basis.frR Documentation

Functional Regression with functional response using basis representation.

Description

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

Usage

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:

  • call The matched call.

  • a.est Intercept parameter estimated.

  • coefficientes the matrix of the coefficients.

  • beta.est A bivariate functional data object of class bifd with the estimated parameters of β(s,t).

  • fitted.values Estimated response.

  • residuals y minus fitted values.

  • y Functional response.

  • x Functional explanatory data.

  • lambda.s A roughness penalty with respect to s .

  • lambda.t A roughness penalty with respect to t.

  • Lfdobj.s A linear differential operator with respect to s.

  • Lfdobj.t A linear differential operator with respect to t.

  • weights Weights.

Author(s)

Manuel Febrero-Bande, Manuel Oviedo de la Fuente manuel.oviedo@udc.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

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

fda.usc documentation built on Oct. 17, 2022, 9:06 a.m.