| Title: | Robust Sufficient Dimension Reduction |
|---|---|
| Description: | A novel sufficient-dimension reduction method is robust against outliers using alpha-distance covariance and manifold-learning in dimensionality reduction problems. Please refer Hsin-Hsiung Huang, Feng Yu & Teng Zhang (2024) <doi:10.1080/10485252.2024.2313137> for the details. |
| Authors: | Sheau-Chiann Chen [aut, cre] (ORCID: <https://orcid.org/0000-0002-5574-1434>), Shilin Zhao [aut], Hsin-Hsiung Bill Huang [aut] (ORCID: <https://orcid.org/0000-0001-7150-7229>) |
| Maintainer: | Sheau-Chiann Chen <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 1.0.3.0 |
| Built: | 2026-05-21 10:16:21 UTC |
| Source: | https://github.com/cran/rSDR |
Perform R bootstrap replications of the cost function in rSDR method and return the corresponding optimal alpha.
optimal_alpha_boot(alpha.v,X,Y,d,R,maxiter=1000,tol=1e-7)optimal_alpha_boot(alpha.v,X,Y,d,R,maxiter=1000,tol=1e-7)
alpha.v |
user-supplied alpha sequence. The default is alpha.v=c(0.3,0.4,0.5,0.6,0.7). |
X |
an |
Y |
an |
d |
the number of reduced dimension. The default is d=3. |
R |
the number of bootstrap replicates. |
maxiter |
maxiter is the maximum number of iterations allowed for the solver (a non-negative integer). See the Max_Iteration parameter in |
tol |
tol is used to assess convergence, see the Tolerance parameter in |
An object of class "optimal_alpha_boot" is returned. The returned value contains the following components:
value of alpha that gives minimum f_test.meam.
The mean of cost function by the alpha sequence - a vector of length length(alpha.v).
The standard deviation of cost function by the alpha sequence.
An length(alpha.v) matrix. The cost value for each fold at a given alpha.
The value of d as passed to optimal_alpha_boot.
The value of R as passed to optimal_alpha_boot.
library(ManifoldOptim) library(rSDR) library(future) library(future.apply) utils::data("ionosphere", package = "fdm2id") X<-as.matrix(ionosphere[,c(1:33)]) Y<-ifelse(ionosphere[,34]=='b',0,1) Y<-matrix(Y,length(Y),1) set.seed(2435) # plan(multisession) will launch parallel workers running in the background # to save running time. To shut down background workers launched this way, call # plan(sequential) # use all local cores except one # future::plan(future::multisession, workers = future::availableCores() - 1) # use 2 cores for parallel future::plan("multisession", workers = 2) opt_results<-optimal_alpha_boot(alpha.v=c(0.3,0.5,0.7),X=X,Y=Y,d=3,R=5) opt_results future::plan(sequential)library(ManifoldOptim) library(rSDR) library(future) library(future.apply) utils::data("ionosphere", package = "fdm2id") X<-as.matrix(ionosphere[,c(1:33)]) Y<-ifelse(ionosphere[,34]=='b',0,1) Y<-matrix(Y,length(Y),1) set.seed(2435) # plan(multisession) will launch parallel workers running in the background # to save running time. To shut down background workers launched this way, call # plan(sequential) # use all local cores except one # future::plan(future::multisession, workers = future::availableCores() - 1) # use 2 cores for parallel future::plan("multisession", workers = 2) opt_results<-optimal_alpha_boot(alpha.v=c(0.3,0.5,0.7),X=X,Y=Y,d=3,R=5) opt_results future::plan(sequential)
Performs k-folds cross-validation for rSDR method and returns the corresponding optimal alpha.
optimal_alpha_cv(alpha.v,X,Y,d,kfolds=10,maxiter=1000,tol=1e-7)optimal_alpha_cv(alpha.v,X,Y,d,kfolds=10,maxiter=1000,tol=1e-7)
alpha.v |
user-supplied alpha sequence. The default is alpha.v=c(0.3,0.4,0.5,0.6,0.7). |
X |
an |
Y |
an |
d |
the number of reduced dimension. The default is d=3. |
kfolds |
the number of folds - default is 10. |
maxiter |
maxiter is the maximum number of iterations allowed for the solver (a non-negative integer). See the Max_Iteration parameter in |
tol |
tol is used to assess convergence, see the Tolerance parameter in |
An object of class "optimal_alpha_cv" is returned. The returned value contains the following components:
value of alpha that gives minimum f_test.meam.
The mean of cost value by the alpha sequence - a vector of length length(alpha.v).
The standard deviation of cost value by the alpha sequence - a vector of length length(alpha.v).
A kfolds length(alpha.v) matrix. The cost value for each fold at a given alpha.
The value of d as passed to optimal_alpha_cv.
The value of kfolds as passed to optimal_alpha_cv.
library(ManifoldOptim) library(rSDR) library(future) library(future.apply) utils::data("ionosphere", package = "fdm2id") X<-as.matrix(ionosphere[,c(1:33)]) Y<-ifelse(ionosphere[,34]=='b',0,1) Y<-matrix(Y,length(Y),1) set.seed(2435) # plan(multisession) will launch parallel workers running in the background # to save running time. To shut down background workers launched this way, call # plan(sequential) # use all local cores except one # future::plan(future::multisession, workers = future::availableCores() - 1) # use 2 cores for parallel future::plan("multisession", workers = 2) opt_results<-optimal_alpha_cv(alpha.v=c(0.3, 0.5, 0.7),X=X,Y=Y,d=3,kfolds=5) opt_resultslibrary(ManifoldOptim) library(rSDR) library(future) library(future.apply) utils::data("ionosphere", package = "fdm2id") X<-as.matrix(ionosphere[,c(1:33)]) Y<-ifelse(ionosphere[,34]=='b',0,1) Y<-matrix(Y,length(Y),1) set.seed(2435) # plan(multisession) will launch parallel workers running in the background # to save running time. To shut down background workers launched this way, call # plan(sequential) # use all local cores except one # future::plan(future::multisession, workers = future::availableCores() - 1) # use 2 cores for parallel future::plan("multisession", workers = 2) opt_results<-optimal_alpha_cv(alpha.v=c(0.3, 0.5, 0.7),X=X,Y=Y,d=3,kfolds=5) opt_results
Plot for the mean with the standard deviation of cost function and alpha
plot_alpha(opt_results)plot_alpha(opt_results)
opt_results |
opt_results is from either |
No return value, showing the mean and standard deviation of cost function for each alpha value.
library(ManifoldOptim) library(rSDR) utils::data("ionosphere", package = "fdm2id") X<-as.matrix(ionosphere[,c(1:33)]) Y<-ifelse(ionosphere[,34]=='b',0,1) Y<-matrix(Y,length(Y),1) set.seed(2435) # plan(multisession) will launch parallel workers running in the background # to save running time. To shut down background workers launched this way, call # plan(sequential) # use all local cores except one # future::plan(future::multisession, workers = future::availableCores() - 1) # use 2 cores for parallel future::plan("multisession", workers = 2) opt_results<-optimal_alpha_cv(alpha.v=c(0.3, 0.5, 0.7),X=X,Y=Y,d=3,kfolds=10) plot_alpha(opt_results=opt_results)library(ManifoldOptim) library(rSDR) utils::data("ionosphere", package = "fdm2id") X<-as.matrix(ionosphere[,c(1:33)]) Y<-ifelse(ionosphere[,34]=='b',0,1) Y<-matrix(Y,length(Y),1) set.seed(2435) # plan(multisession) will launch parallel workers running in the background # to save running time. To shut down background workers launched this way, call # plan(sequential) # use all local cores except one # future::plan(future::multisession, workers = future::availableCores() - 1) # use 2 cores for parallel future::plan("multisession", workers = 2) opt_results<-optimal_alpha_cv(alpha.v=c(0.3, 0.5, 0.7),X=X,Y=Y,d=3,kfolds=10) plot_alpha(opt_results=opt_results)
Function for plotting of projected_data from rSDR results.
plot_rSDR(projected_data,Y,Y.name,colors=NULL)plot_rSDR(projected_data,Y,Y.name,colors=NULL)
projected_data |
projected data from rSDR results. |
Y |
an |
Y.name |
label for y-axis |
colors |
Assign specific colors to each level of the response variable. |
No return value, visualizing reduced-dimensional data using 1D, 2D, or 3D projections. When the reduced dimension exceeds three, pairwise scatter plots are automatically generated.
library(ManifoldOptim) library(rSDR) utils::data("ionosphere", package = "fdm2id") X<-as.matrix(ionosphere[,c(1:33)]) Y<-ifelse(ionosphere[,34]=='b',0,1) Y<-matrix(Y,length(Y),1) ionosphere$V35<-factor(ionosphere$V35,levels=c('b','g'),labels=c('Bad','Good')) set.seed(2435) sdr_result<-rSDR(X=X, Y=Y, d=3, alpha=0.3,maxiter=1000,tol=1e-7) plot_rSDR(projected_data=sdr_result$projected_data,Y=ionosphere$V35, Y.name='group',colors=c("#374E55FF", "#DF8F44FF"))library(ManifoldOptim) library(rSDR) utils::data("ionosphere", package = "fdm2id") X<-as.matrix(ionosphere[,c(1:33)]) Y<-ifelse(ionosphere[,34]=='b',0,1) Y<-matrix(Y,length(Y),1) ionosphere$V35<-factor(ionosphere$V35,levels=c('b','g'),labels=c('Bad','Good')) set.seed(2435) sdr_result<-rSDR(X=X, Y=Y, d=3, alpha=0.3,maxiter=1000,tol=1e-7) plot_rSDR(projected_data=sdr_result$projected_data,Y=ionosphere$V35, Y.name='group',colors=c("#374E55FF", "#DF8F44FF"))
Robust Sufficient Dimension Reduction with alpha-Distance Covariance and Stiefel Manifold Learning for supervised dimension reduction.
rSDR(X, Y, d, alpha=0.5,maxiter=1000,tol=1e-7)rSDR(X, Y, d, alpha=0.5,maxiter=1000,tol=1e-7)
X |
an |
Y |
an |
d |
the number of reduced dimension. |
alpha |
this parameter represents the exponent applied to the Euclidean distance in the computation of distance covariance. When alpha=1, it corresponds to the classical distance covariance. When 0 < alpha < 1, it is a more robust version by reducing the influence of large values in the distance matrices. |
maxiter |
maxiter is the maximum number of iterations allowed for the solver (a non-negative integer). See the Max_Iteration parameter in |
tol |
tol is used to assess convergence, see the Tolerance parameter in |
The returned value is an object of class "rSDR", containing the following components:
an matrix representing the projected data using the rSDR method.
a matrix.Solve by
an optimal of C is obtained by maximizing the target function using ManifoldOptim method.
The value of cost function f is defined as the negative of the target function.
Hsin-Hsiung Huang, Feng Yu & Teng Zhang (19 Feb 2024): Robust sufficient dimension reduction via alpha-distance covariance, Journal of Nonparametric Statistics, DOI:10.1080/10485252.2024.2313137
library(ManifoldOptim) library(rSDR) utils::data("ionosphere", package = "fdm2id") X<-as.matrix(ionosphere[,c(1:33)]) Y<-ifelse(ionosphere[,34]=='b',0,1) Y<-matrix(Y,length(Y),1) set.seed(2435) sdr_result<-rSDR(X=X, Y=Y, d=3, alpha=0.3,maxiter=1000,tol=1e-7)library(ManifoldOptim) library(rSDR) utils::data("ionosphere", package = "fdm2id") X<-as.matrix(ionosphere[,c(1:33)]) Y<-ifelse(ionosphere[,34]=='b',0,1) Y<-matrix(Y,length(Y),1) set.seed(2435) sdr_result<-rSDR(X=X, Y=Y, d=3, alpha=0.3,maxiter=1000,tol=1e-7)