The package adass implements the adaptive smoothing
spline (AdaSS) estimator for the function-on-function linear regression
model proposed by Centofanti et al. (2023). The AdaSS estimator is
obtained by the optimization of an objective function with two spatially
adaptive penalties, based on initial estimates of the partial
derivatives of the regression coefficient function. This allows the
proposed estimator to adapt more easily to the true coefficient function
over regions of large curvature and not to be undersmoothed over the
remaining part of the domain. The package comprises two main functions
adass.fr
and adass.fr_eaass
. The former
implements the AdaSS estimator for fixed tuning parameters. The latter
executes the evolutionary algorithm for the adaptive smoothing spline
estimator (EAASS) algorithm to select the optimal tuning parameter
combination as described in Centofanti et al. (2023).
You can install the released version of adass from CRAN with:
install.packages("adass")
The development version can be installed from GitHub with:
# install.packages("devtools")
::install_github("unina-sfere/adass") devtools
This is a basic example which shows you how to apply the two main
functions adass.fr
and adass.fr_eaass
on a
synthetic dataset generated as described in the simulation study of
Centofanti et al. (2023).
We start by loading and attaching the adass package.
library(adass)
Then, we generate the synthetic dataset and build the basis function sets as follows.
<-"Scenario HAT"
case<-simulate_data(case,n_obs=10)
data<- data$X_fd
X_fd <- data$Y_fd
Y_fd <- fda::create.bspline.basis(c(0,1),nbasis = 30,norder = 4)
basis_s <- fda::create.bspline.basis(c(0,1),nbasis = 30,norder = 4) basis_t
Then, we calculate the initial estimate of the partial derivatives of the coefficient function.
<-adass.fr(Y_fd,X_fd,basis_s = basis_s,basis_t = basis_t,tun_par=c(10^-6,10^-6,0,0,0,0))
mod_smooth <-seq(0,1,length.out = 10)
grid_s<-seq(0,1,length.out = 10)
grid_t<-fda::eval.bifd(grid_s,grid_t,mod_smooth$Beta_hat_fd,sLfdobj = 2)
beta_der_eval_s<-fda::eval.bifd(grid_s,grid_t,mod_smooth$Beta_hat_fd,tLfdobj = 2) beta_der_eval_t
Then, we apply the EAASS algorithm through the
adass.fr_eaass
function to identify the optimal combination
of tuning parameters.
<-adass.fr_eaass(Y_fd,X_fd,basis_s,basis_t,
mod_adass_eaassbeta_ders=beta_der_eval_s, beta_dert=beta_der_eval_t,
rand_search_par=list(c(-8,4),c(-8,4),c(0,0.1),c(0,4),c(0,0.1),c(0,4)),
grid_eval_ders=grid_s,grid_eval_dert=grid_t,
popul_size = 10,ncores=8,iter_num=5)
Finally, adass.fr
is applied with tuning parameters
fixed to their optimal values.
<-adass.fr(Y_fd, X_fd, basis_s = basis_s, basis_t = basis_t,
mod_adass tun_par=mod_adass_eaass$tun_par_opt,beta_ders = beta_der_eval_s,
beta_dert = beta_der_eval_t,grid_eval_ders=grid_s,grid_eval_dert=grid_t )
The resulting estimator is plotted as follows.
plot(mod_adass)