Learn R Programming

slasso (version 1.0.1)

slasso.fr_cv: Cross-validation for the S-LASSO estimator

Description

K-fold cross-validation procedure to choose the tuning parameters for the S-LASSO estimator (Centofanti et al., 2020).

Usage

slasso.fr_cv(
  Y_fd,
  X_fd,
  basis_s,
  basis_t,
  K = 10,
  kss_rule_par = 0.5,
  lambda_L_vec = NULL,
  lambda_s_vec = NULL,
  lambda_t_vec = NULL,
  B0 = NULL,
  ncores = 1,
  ...
)

Value

A list containing the following arguments:

  • lambda_opt_vec: Vector of optimal tuning parameters.

  • CV: Estimated prediction errors.

  • CV_sd: Standard errors of the estimated prediction errors.

  • per_0: The fractions of domain where the coefficient function is zero for all the tuning parameters combinations.

  • comb_list: The combinations of lambda_L,lambda_s and lambda_t explored.

  • Y_fd: The response functions.

  • X_fd: The covariate functions.

Arguments

Y_fd

An object of class fd corresponding to the response functions.

X_fd

An object of class fd corresponding to the covariate functions.

basis_s

B-splines basis along the s-direction of class basisfd.

basis_t

B-splines basis along the t-direction of class basisfd.

K

Number of folds. Default is 10.

kss_rule_par

Parameter of the k-standard error rule. If kss_rule_par=0 the tuning parameters that minimize the estimated prediction error are chosen. Default is 0.5.

lambda_L_vec

Vector of regularization parameters of the functional LASSO penalty.

lambda_s_vec

Vector of regularization parameters of the smoothness penalty along the s-direction.

lambda_t_vec

Vector of regularization parameters of the smoothness penalty along the t-direction.

B0

Initial estimator of the basis coefficients matrix of the coefficient function. Should have dimensions in accordance with the basis dimensions of basis_s and basis_t.

ncores

If ncores>1, then parallel computing is used, with ncores cores. Default is 1.

...

Other arguments to be passed to the Orthant-Wise Limited-memory Quasi-Newton optimization function. See the lbfgs help page of the package lbfgs.

References

Centofanti, F., Fontana, M., Lepore, A., & Vantini, S. (2022). Smooth lasso estimator for the function-on-function linear regression model. Computational Statistics & Data Analysis, 176, 107556.

See Also

slasso.fr

Examples

Run this code
library(slasso)
data<-simulate_data("Scenario II",n_obs=150)
X_fd=data$X_fd
Y_fd=data$Y_fd
domain=c(0,1)
n_basis_s<-60
n_basis_t<-60
breaks_s<-seq(0,1,length.out = (n_basis_s-2))
breaks_t<-seq(0,1,length.out = (n_basis_t-2))
basis_s <- fda::create.bspline.basis(domain,breaks=breaks_s)
basis_t <- fda::create.bspline.basis(domain,breaks=breaks_t)
mod_slasso_cv<-slasso.fr_cv(Y_fd = Y_fd,X_fd=X_fd,basis_s=basis_s,basis_t=basis_t,
lambda_L_vec=seq(0,1,by=1),lambda_s_vec=c(-9),lambda_t_vec=-7,B0=NULL,
max_iterations=10,K=2,invisible=1,ncores=1)

Run the code above in your browser using DataLab