Learn R Programming

fda.usc (version 1.2.3)

fregre.basis.fr: 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. $$Y(t)=\alpha(t)+\int_{T}{X(s)\beta(s,t)ds+\epsilon(t)}$$ where $\alpha(t)$ is the intercept function, $\beta(s,t)$ is the bivariate resgression function and $\epsilon(t)$ are the error term with mean zero.

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 $\beta(s,t)$.
basis.t
Basis related with t and it is used in the estimation of $\beta(s,t)$.
lambda.s
A roughness penalty with respect to s to be applied in the estimation of $\beta(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 $\beta(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.

Value

  • Return:
  • callThe matched call.
  • a.estIntercept parameter estimated.
  • coefficientesthe matrix of the coefficients.
  • beta.estA bivariate functional data object of class bifd with the estimated parameters of $\beta(s,t)$.
  • fitted.valuesEstimated response.
  • residualsy minus fitted values.
  • yFunctional response.
  • xFunctional explanatory data.
  • lambda.sA roughness penalty with respect to s .
  • lambda.tA roughness penalty with respect to t.
  • Lfdobj.sA linear differential operator with respect to s.
  • Lfdobj.tA linear differential operator with respect to t.
  • weightsWeights.

Details

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 $\beta(s,t)$ can be expressed as a double expansion in terms of $K$ basis function $\nu_k$ and $L$ basis functions $\theta_l$, $$\beta(s,t)=\sum_{k=1}^{K}\sum_{l=1}^{L} b_{kl} \nu_{k}(s)\theta_{l}(t)=\nu(s)^{\top}\bold{B}\theta(t)$$ Then, the model can be re--written in a matrix version as, $$Y(t)=\alpha(t)+\int_{T}{X(s)\nu(s)^{\top}\bold{B}\theta(t)ds+\epsilon(t)}=\alpha(t)+\bold{XB}\theta(t)+\epsilon(t)$$ where $\bold{X}=\int X(s)\nu^{\top}(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 $\beta(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 $\beta$'s variations with respect to $s$ and {lambda.t,Lfdobj.t} for penalization of $\beta$'s variations with respect to $t$.

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

Run this code
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.bifd(res1$beta.est,tt,tt)
plot.bifd(res1$beta.est,tt,tt,type="persp",theta=45,phi=30)

Run the code above in your browser using DataLab