| Title: | Aggregated Functional Data Calibration using Splines and Wavelets |
|---|---|
| Description: | Implements methods for calibrating an aggregated functional data model using wavelets or splines. Each aggregated curve is modeled as a linear combination of component functions and known weights. The component functions are estimated using wavelets or splines. The package is based on dos Santos Sousa (2024) <doi:10.1515/mcma-2023-2016>, Saraiva and Dias (2009) <doi:10.47749/T/UNICAMP.2009.471073> and Johnstone and Silverman (1997) <doi:10.1111/1467-9868.00071>. |
| Authors: | Vitor Perrone [aut, cre] (ORCID: <https://orcid.org/0009-0009-6923-7712>), Alex Sousa [aut] (ORCID: <https://orcid.org/0000-0001-5887-3638>) |
| Maintainer: | Vitor Perrone <[email protected]> |
| License: | GPL-3 |
| Version: | 2.0.0 |
| Built: | 2026-10-27 12:05:17 UTC |
| Source: | https://github.com/vitorribasp/functionalcalibration |
This function performs functional calibration based on the following model:
where the functions are estimated using spline basis functions.
In matrix notation, the model is represented as:
functional_calibration_splines(data, weights, x, n_functions = 10)functional_calibration_splines(data, weights, x, n_functions = 10)
data |
A matrix |
weights |
A matrix |
x |
A numeric vector of values at which the function is evaluated. |
n_functions |
Number of spline basis functions to be used for estimating |
The function returns a list containing two objects.
alphaA matrix with the estimated functional coefficients .
PlotsA list of plot objects, each representing the corresponding function .
Saraiva, M. A., & Dias, R. (2009). Analise não-parametrica de dados funcionais: uma aplicação a quimiometria (Doctoral dissertation, Master’s thesis, Universidade Estadual de Campinas, Campinas).
functional_calibration_splines(simulated_data_spl$data, simulated_data_spl$weights, simulated_data_spl$x) functional_calibration_splines(simulated_data_spl$data, simulated_data_spl$weights, simulated_data_spl$x, 12)functional_calibration_splines(simulated_data_spl$data, simulated_data_spl$weights, simulated_data_spl$x) functional_calibration_splines(simulated_data_spl$data, simulated_data_spl$weights, simulated_data_spl$x, 12)
This function performs functional calibration based on the following model:
where the functions are estimated using wavelet decomposition.
In matrix notation, the model is represented as:
functional_calibration_wavelets( data, weights, wavelet = "DaubExPhase", method = "bayesian", tau = 1, p = NULL, sigma = NULL, MC = TRUE, type = "soft", singular = FALSE, corre = FALSE, x = NULL )functional_calibration_wavelets( data, weights, wavelet = "DaubExPhase", method = "bayesian", tau = 1, p = NULL, sigma = NULL, MC = TRUE, type = "soft", singular = FALSE, corre = FALSE, x = NULL )
data |
A matrix |
weights |
A matrix |
wavelet |
A string indicating the wavelet family to be used in the Discrete Wavelet Transform (DWT). |
method |
A string specifying the shrinkage method applied to the empirical wavelet coefficients. Options are: "bayesian", "universal", "sure", "probability", or "cv". |
tau |
A numeric value for the |
p |
A numeric value for the |
sigma |
A numeric value for the |
MC |
A logical evaluating to |
type |
A string indicating whether the thresholding should be "soft" or "hard" (applies only when the method is not "bayesian"). |
singular |
A logical evaluating to |
corre |
A logical evaluating to |
x |
A numeric vector of values at which the function is evaluated. If |
The function returns a list containing two objects:
alphaA matrix with the estimated functional coefficients .
PlotsA list of plot objects, each representing the corresponding function .
dos Santos Sousa, A. R. (2024). A wavelet-based method in aggregated functional data analysis. Monte Carlo Methods and Applications, 30(1), 19-30.
JOHNSTONE, I. M.; SILVERMAN, B. W. Wavelet Threshold Estimators for Data with Correlated Noise. Journal of the Royal Statistical Society: Series B (Statistical Methodology), v. 59, n. 2, p. 319–351, 1997.
functional_calibration_wavelets(simulated_data_wav$data, simulated_data_wav$weights) functional_calibration_wavelets(simulated_data_wav$data, simulated_data_wav$weights, tau = 5, p = 0.95, sigma = 0.1, x = simulated_data_wav$x) functional_calibration_wavelets(simulated_data_wav$data, simulated_data_wav$weights, method = "universal") functional_calibration_wavelets(simulated_data_cor$data, simulated_data_cor$weights, corre = TRUE)functional_calibration_wavelets(simulated_data_wav$data, simulated_data_wav$weights) functional_calibration_wavelets(simulated_data_wav$data, simulated_data_wav$weights, tau = 5, p = 0.95, sigma = 0.1, x = simulated_data_wav$x) functional_calibration_wavelets(simulated_data_wav$data, simulated_data_wav$weights, method = "universal") functional_calibration_wavelets(simulated_data_cor$data, simulated_data_cor$weights, corre = TRUE)
Generates the plot of the aggregated curve based on the functional coefficients and their corresponding weights. The aggregated curve is computed as:
plot_aggregated_curve(alpha, weights, title = NULL, x = NULL)plot_aggregated_curve(alpha, weights, title = NULL, x = NULL)
alpha |
A numeric matrix where each column represents the values of a function |
weights |
A numeric vector with the weight values corresponding to each function |
title |
A string specifying the title of the plot. |
x |
A numeric vector of values at which the function is evaluated. If |
The function returns the plot of the aggregated function.
plot_aggregated_curve(simulated_data_wav$alphas, c(0.7, 0.3)) plot_aggregated_curve(simulated_data_wav$alphas, c(0.7, 0.3), "Aggregated Curve Example", simulated_data_wav$x)plot_aggregated_curve(simulated_data_wav$alphas, c(0.7, 0.3)) plot_aggregated_curve(simulated_data_wav$alphas, c(0.7, 0.3), "Aggregated Curve Example", simulated_data_wav$x)
This is a simulated dataset designed to illustrate the functionalities of the package.
It contains 100 samples of aggregated data generated from two functions, and , with added Gaussian noise .
The functions used in the simulation are:
The simulations were performed over an equally spaced grid of 1024 points in the interval [-1, 2]. These functions were linearly combined using random concentrations to generate the samples, with the addition of Gaussian noise.
simulated_datasimulated_data
An object of class list of length 4.
dataA data frame with 1024 rows and 100 columns.
Each column represents one sample of the aggregated functions with Gaussian noise .
weigthsA data frame with 2 rows and 100 columns.
Each column contains the random concentrations used to aggregate the two functions in each sample.
xA numeric vector of length 1024.
The grid of x-values used in the simulation, equally spaced from -1 to 2.
alphasA data frame with 1024 rows and 2 columns.
The true values of the functions and evaluated over the x grid.
This is a simulated dataset designed to illustrate the functionalities of the package.
It contains 100 samples of aggregated data generated from two functions, and , with added noise AR(1) process with autoregressive parameter 0.5 and Gaussian process noise distributed as .
The functions used in the simulation are:
where
,
,
.
The simulations were performed over an equally spaced grid of 1024 points in the interval [0, 1]. These functions were linearly combined using random concentrations to generate the samples, with the addition of AR(1) noise.
simulated_data_corsimulated_data_cor
An object of class list of length 4.
dataA data frame with 1024 rows and 100 columns.
Each column represents one sample of the aggregated functions with AR(1) noise.
weigthsA data frame with 2 rows and 100 columns.
Each column contains the random concentrations used to aggregate the two functions in each sample.
xA numeric vector of length 1024.
The grid of x-values used in the simulation, equally spaced from 0 to 1.
alphasA data frame with 1024 rows and 2 columns.
The true values of the functions and evaluated over the x grid.
This is a simulated dataset designed to illustrate the functionalities of the package.
It contains 100 samples of aggregated data generated from two functions, and , with added Gaussian noise .
The functions used in the simulation are:
The simulations were performed over an equally spaced grid of 1024 points in the interval [0, 1]. These functions were linearly combined using random concentrations to generate the samples, with the addition of Gaussian noise.
simulated_data_splsimulated_data_spl
An object of class list of length 4.
dataA data frame with 1024 rows and 100 columns.
Each column represents one sample of the aggregated functions with Gaussian noise.
weigthsA data frame with 2 rows and 100 columns.
Each column contains the random concentrations used to aggregate the two functions in each sample.
xA numeric vector of length 1024.
The grid of x-values used in the simulation, equally spaced from 0 to 1.
alphasA data frame with 1024 rows and 2 columns.
The true values of the functions and evaluated over the x grid.
This is a simulated dataset designed to illustrate the functionalities of the package.
It contains 100 samples of aggregated data generated from two functions, and , with added Gaussian noise .
The functions used in the simulation are:
where
,
,
.
The simulations were performed over an equally spaced grid of 1024 points in the interval [0, 1]. These functions were linearly combined using random concentrations to generate the samples, with the addition of Gaussian noise.
simulated_data_wavsimulated_data_wav
An object of class list of length 4.
dataA data frame with 1024 rows and 100 columns.
Each column represents one sample of the aggregated functions with Gaussian noise.
weigthsA data frame with 2 rows and 100 columns.
Each column contains the random concentrations used to aggregate the two functions in each sample.
xA numeric vector of length 1024.
The grid of x-values used in the simulation, equally spaced from 0 to 1.
alphasA data frame with 1024 rows and 2 columns.
The true values of the functions and evaluated over the x grid.
Estimates the weights associated with the functional coefficients
using the using Ordinary Least Squares.
The problem can be formulated as:
where is the aggregated function evaluated at each point ,
are the functional coefficients, and are the weights to be estimated.
weight_estimation(data, alpha)weight_estimation(data, alpha)
data |
A numeric vector representing one sample of the aggregated function |
alpha |
A numeric matrix where each column represents the values of a function |
The function returns a vector with the estimated weights obtained using Ordinary Least Squares.
weight_estimation(simulated_data_wav$data[,1], simulated_data_wav$alphas)weight_estimation(simulated_data_wav$data[,1], simulated_data_wav$alphas)