Learn R Programming

fdars (version 0.3.3)

fdata2fd: Convert Functional Data to fd class

Description

Converts an fdata object to an fd object from the fda package. Requires the fda package to be installed.

Usage

fdata2fd(fdataobj, nbasis = 10, type = c("bspline", "fourier"))

Value

An object of class 'fd' from the fda package.

Arguments

fdataobj

An object of class 'fdata'.

nbasis

Number of basis functions (default 10).

type

Type of basis: "bspline" (default) or "fourier".

Examples

Run this code
if (FALSE) { # requireNamespace("fda", quietly = TRUE)
t <- seq(0, 1, length.out = 50)
X <- matrix(0, 20, 50)
for (i in 1:20) X[i, ] <- sin(2*pi*t) + rnorm(50, sd = 0.1)
fd <- fdata(X, argvals = t)
fd_obj <- fdata2fd(fd, nbasis = 10)
}

Run the code above in your browser using DataLab