View source: R/fda.preprocess.R
fda.preprocess | R Documentation |
The fda.preprocess
function transforms discrete point observations of functional data (functional time series) into functional data evaluated on a dense equidistant grid. This function uses a direct interpolation approach, using natural splines to interpolate missing values. In addition, it performs the eigendecomposition of the sample covariance operator and computes the empirical Karhunen-Loève expansion (empirical functional principal components). Missing values at the beginning or end are reconstructed using the Kneip and Liebl (2020) optimal reconstruction operator.
fda.preprocess(data, observationgrid = NULL, workinggrid = NULL)
data |
A multivariate time series or data in 'ts' or 'data.frame' format. The function expects data to represent discrete observations of functional data (functional time series) that may contain missing values. |
observationgrid |
An optional numeric vector specifying the observation grid of the input data. If NULL (default), the function attempts to infer the grid from column names of 'data'. |
workinggrid |
An optional numeric vector defining an equidistant grid for the analysis. If NULL (default), the function generates an equidistant grid based on the minimum difference in 'observationgrid' |
Returns an object of class 'fdaobj', which includes the following components:
densedata |
The data interpolated onto the dense working grid. |
workinggrid |
The generated or specified dense equidistant working grid. |
operator |
The operator for which the eigenelements are computed. Here: "sample_covariance(FPC)". |
scores |
The coefficients representing the projections of 'densedata' onto each eigenfunction. |
eigenfunctions |
A matrix of orthonormal eigenfunctions derived from the sample covariance operator, representing the functional principal components. |
eigenvalues |
The eigenvalues associated with each eigenfunction, indicating the variance explained by each principal component. |
scores.centered |
The projection coefficients after demeaning 'densedata'. |
meanfunction |
The sample mean function calculated across the dense data. |
raw.data |
The original input data. |
observationgrid |
The observation grid used or inferred from the input data. |
Hsing, T., & Eubank, R. (2015). Theoretical foundations of functional data analysis, with an introduction to linear operators. John Wiley & Sons.
Kneip, A., & Liebl, D. (2020). On the optimal reconstruction of partially observed functional data. The Annals of Statistics, 48, 1692-1717.
Otto, S., & Salish, N. (2024). Approximate Factor Models For Functional Time Series. arXiv:2201.02532.
# Example with standard working grid
fed = load.fed()
fda.preprocess(data = fed)
# Example with a customized tighter working grid
wg = seq(1,360, by=0.5)
fda.preprocess(fed, workinggrid = wg)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.