| 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 the paper <doi:10.1515/mcma-2023-2016> and the Master's thesis <doi:10.47749/T/UNICAMP.2009.471073>. |
| 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: | 1.0.0 |
| Built: | 2026-05-16 06:09:46 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$data, simulated_data$weights, simulated_data$x) functional_calibration_splines(simulated_data$data, simulated_data$weights, simulated_data$x, 12)functional_calibration_splines(simulated_data$data, simulated_data$weights, simulated_data$x) functional_calibration_splines(simulated_data$data, simulated_data$weights, simulated_data$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 = FALSE, type = "soft", singular = FALSE, x = NULL )functional_calibration_wavelets( data, weights, wavelet = "DaubExPhase", method = "bayesian", tau = 1, p = NULL, sigma = NULL, MC = FALSE, type = "soft", singular = 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 |
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.
functional_calibration_wavelets(simulated_data$data, simulated_data$weights) functional_calibration_wavelets(simulated_data$data, simulated_data$weights, tau = 5, p = 0.95, sigma = 0.1, x = simulated_data$x) functional_calibration_wavelets(simulated_data$data, simulated_data$weights, method = "universal")functional_calibration_wavelets(simulated_data$data, simulated_data$weights) functional_calibration_wavelets(simulated_data$data, simulated_data$weights, tau = 5, p = 0.95, sigma = 0.1, x = simulated_data$x) functional_calibration_wavelets(simulated_data$data, simulated_data$weights, method = "universal")
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$alphas, c(0.7, 0.3)) plot_aggregated_curve(simulated_data$alphas, c(0.7, 0.3), "Aggregated Curve Example", simulated_data$x)plot_aggregated_curve(simulated_data$alphas, c(0.7, 0.3)) plot_aggregated_curve(simulated_data$alphas, c(0.7, 0.3), "Aggregated Curve Example", simulated_data$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.
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$data[,1], simulated_data$alphas)weight_estimation(simulated_data$data[,1], simulated_data$alphas)