fdata2basis: Compute fucntional coefficients from functional data...

View source: R/fdata2basis.R

fdata2basisR Documentation

Compute fucntional coefficients from functional data represented in a base of functions

Description

Compute fucntional coefficients from functional data (fdata class object) represented in a basis (fixed of data-driven basis).

Usage

fdata2basis(fdataobj, basis, method = c("grid", "inprod"))

## S3 method for class 'basis.fdata'
summary(object, draw = TRUE, index = NULL, ...)

Arguments

fdataobj

fdata class object.

basis

a functional basis object defining the basis

method

character string, if it is "grid" the fdata object is evaluated in the grid (argvals of fdata), if it is "inprod" the basis representation of functional data is computed by inner product (inprod.fdata(fdataobj,basis)).

object

basis.fdata class object calculated by: fdata2basis

draw

logical, original curves and their basis representation are plotted

index

vector, by default (if NULL) the first n curves are plotted, where n = min(4, length(fdataobj)). Otherwise, index vector indicates taht curvesare plotted.

...

Further arguments passed to or from other methods.

Value

fdata2basis fdata2bais function return:

  • coefa matrix or two-dimensional array of coefficients.

  • basisbasis of fdata class evaluated in the same grid of fdataobj.

summary function return:

  • Ra matrix with a measure similar to R-sq for each curve aproximation (by row) and number of basis elements (by column).

Author(s)

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

See Also

Inverse function: gridfdata. Alternative method: fdata2pc, fdata2pls.

Examples

## Not run: 
T <- 71
S <- 51
tj <- round(seq(0,1,len=T),3)
si <- round(seq(0,1,len=S),3)
beta1 <- outer(si,tj,function(si,tj){exp(-5*abs((tj-si)/5))})
nbasis.s =7
nbasis.t=11
base.s <- create.fourier.basis(c(0,1),nbasis=nbasis.s)
base.t <- create.fourier.basis(c(0,1),nbasis=nbasis.t)
y1 <- fdata(rbind(log(1+tj),1-5*(tj-0.5)^2),argvals=tj,rangeval=c(0,1))
aa <- fdata2basis(y1,base.t,method="inprod")
summary(aa)
plot(gridfdata(aa$coefs,aa$basis))
lines(y1,lwd=2,col=c(3,4),lty=2)

## End(Not run)

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