Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

fdata

Converts raw data or other functional data classes into fdata class.


Description

Create a functional data object of class fdata from (matrix, data.frame, numeric, integer, fd, fds, fts or sfts) class data.

Usage

fdata(mdata, argvals = NULL, rangeval = NULL, names = NULL, fdata2d = FALSE)

Arguments

mdata

Matrix of set cases with dimension (n x m), where n is the number of curves and m are the points observed in each curve.

argvals

Argvals, by default: 1:m.

rangeval

(optional) Range of discretization points, by default: range(argvals).

names

(optional) list with tree components: main an overall title, xlab title for x axis and ylab title for y axis.

fdata2d

TRUE class fdata2d, the functional data is observed in at least a two grids (the argvals is a list of vectors). By default fdata2d=FALSE the functional data is observed in a single grid (the argvals is a vector).

Value

Return fdata class object with:

  • "data": matrix of set cases with dimension (n x m), where n is the number of curves and m are the points observed in each curve

  • "rangeval": the discretizations points values, if not provided: 1:m

  • "rangeval": range of the discretizations points values, by default: range(argvals)

  • "names": (optional) list with main an overall title, xlab title for x axis and ylab title for y axis.

Author(s)

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

References

Febrero-Bande, M., Oviedo de la Fuente, M. (2012). Statistical Computing in Functional Data Analysis: The R Package fda.usc. Journal of Statistical Software, 51(4), 1-28. http://www.jstatsoft.org/v51/i04/

See Also

See Also as plot.fdata

Examples

## Not run: 
data(phoneme)
mlearn<-phoneme$learn[1:4,1:150]
# Center curves
fdata.c=fdata.cen(mlearn)$Xcen
par(mfrow=c(2,1))
plot(mlearn,type="l")
plot(fdata.c,type="l")

# Convert  from class fda to fdata
bsp1 <- create.bspline.basis(c(1,150),21)
fd1 <- Data2fd(1:150,y=t(mlearn$data),basisobj=bsp1)
fdataobj=fdata(fd1)

# Convert  from class fds, fts or sfts to fdata
#require(fds)
#a=fds(x = 1:20, y = Simulationdata$y, xname = "x", 
# yname = "Simulated value")
#b=fts(x = 15:49, y = Australiasmoothfertility$y, xname = "Age",
#    yname = "Fertility rate")
#c=sfts(ts(as.numeric(ElNino_ERSST_region_1and2$y), frequency = 12), xname = "Month",
#yname = "Sea surface temperature")
#class(a);class(b);class(c)
#fdataobj=fdata(b)

## End(Not run)

fda.usc

Functional Data Analysis and Utilities for Statistical Computing

v2.0.2
GPL-2
Authors
Manuel Febrero Bande [aut], Manuel Oviedo de la Fuente [aut, cre], Pedro Galeano [ctb], Alicia Nieto [ctb], Eduardo Garcia-Portugues [ctb]
Initial release
2020-02-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.