eFun: Generate orthonormal eigenfunctions

View source: R/simulation.R

eFunR Documentation

Generate orthonormal eigenfunctions

Description

This function calculates M (orthonormal) basis functions on a given interval, that can be interpreted as the first M eigenfunctions of an appropriate data generating process of functional data.

Usage

eFun(argvals, M, ignoreDeg = NULL, type)

Arguments

argvals

A vector of numerics, defining a (fine) grid on the interval for which the basis functions are computed.

M

An integer, specifying the number of functions that are calculated.

ignoreDeg

A vector of numerics, specifying the degrees to be ignored for type "PolyHigh". Defaults to NULL. See Details.

type

A character string, specifying the type of functions that are calculated. See Details.

Details

The function implements three families of orthonormal basis functions plus variations of them. The parameter type, that specifies the functions to be calculated, can have the following values:

  • "Poly": Calculate orthonormal Legendre polynomials of degree 0,...,M-1.

  • "PolyHigh": Calculate M orthonormal Legendre Polynomials of higher degree. The vector of indices ignoreDeg specifies the functions to be ignored. If ignoreDeg is not specified, the function returns an error.

  • "Fourier": Calculate the first M Fourier basis functions.

  • "FourierLin": Calculate the first M-1 Fourier basis functions plus the linear function, orthonormalized to the previous functions via Gram-Schmidts method. This type is currently implemented for functions on the unit interval [0,1] only. If the function is called with other argvals, an error is thrown.

  • "Wiener": Calculate the first M orthonormal eigenfunctions of the Wiener process.

Value

A univariate functional data object of class funData containing the basis functions on the given interval.

See Also

funData, simFunData, simMultiFunData

Examples

oldPar <- par(no.readonly = TRUE)

argvals <- seq(0,1,0.01)

par(mfrow = c(3,2))
plot(eFun(argvals, M = 4, type = "Poly"), main = "Poly", ylim = c(-3,3))
plot(eFun(argvals, M = 4, ignoreDeg = 1:2, type = "PolyHigh"), main = "PolyHigh",  ylim = c(-3,3))
plot(eFun(argvals, M = 4, type = "Fourier"), main = "Fourier", ylim = c(-3,3))
plot(eFun(argvals, M = 4, type = "FourierLin"), main = "FourierLin", ylim = c(-3,3))
plot(eFun(argvals, M = 4, type = "Wiener"), main = "Wiener",  ylim = c(-3,3))
par(oldPar)

funData documentation built on May 29, 2024, 6:08 a.m.