View source: R/fregre.basis.fr.r
fregre.basis.fr | R Documentation |
Computes functional regression between functional explanatory variable X(s) and functional response Y(t) using basis representation.
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, ... )
x |
Functional explanatory variable. |
y |
Functional response variable. |
basis.s |
Basis related with |
basis.t |
Basis related with |
lambda.s |
A roughness penalty with respect to |
lambda.t |
A roughness penalty with respect to |
Lfdobj.s |
A linear differential operator object with respect to
|
Lfdobj.t |
A linear differential operator object with respect to
|
weights |
Weights. |
... |
Further arguments passed to or from other methods. |
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.
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.
Manuel Febrero-Bande, Manuel Oviedo de la Fuente manuel.oviedo@udc.es
Ramsay, James O., and Silverman, Bernard W. (2006), Functional Data Analysis, 2nd ed., Springer, New York.
See Also as: predict.fregre.fr
.
Alternative method: linmod
.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.