as.funts: Convert Object to a funts

View source: R/as.R

as.funtsR Documentation

Convert Object to a funts

Description

This function allows you to convert various types of objects into a functional time series (funts) object.

Usage

as.funts(obj, basis = NULL)

Arguments

obj

the object to be converted. It can be an object of class fd (functional data) of the package 'fda', fts (functional time series) of the package 'rainbow' types.

basis

an optional argument specifying the basis to be used for the resulting funts object when converting from fts objects. If not provided, a B-spline basis will be created by default.

Value

An object of class funts.

Note

Only objects of class fd (functional data) and fts (functional time series) can be converted to a funts object. Other types will result in an error.

See Also

funts, create.bspline.basis

Examples

require(rainbow)
class(Australiasmoothfertility)
x_funts1 <- as.funts(Australiasmoothfertility)
plot(x_funts1, main = "Australians Fertility")

require(fda)
bs <- create.bspline.basis(rangeval = c(15, 49), nbasis = 13)
fd_obj <- smooth.basis(argvals = Australiasmoothfertility$x, Australiasmoothfertility$y, bs)$fd

x_funts <- as.funts(fd_obj)
plotly_funts(x_funts,
  main = "Australians Fertility",
  ylab = "Fertility rate",
  xlab = "Age"
)

Rfssa documentation built on May 29, 2024, 8:58 a.m.