Learn R Programming

ssMRCD (version 1.1.0)

select_sparsity: Optimal Sparsity Parameter Selection for PCA

Description

Optimal Sparsity Parameter Selection for PCA

Usage

select_sparsity(
  COVS,
  k = 1,
  rho = NULL,
  cor = FALSE,
  eta = seq(0, 5, by = 0.2),
  gamma = seq(0, 1, 0.05),
  eps_threshold = 0.001,
  eps_root = 0.1,
  eps_ADMM = 1e-04,
  n_max = 300,
  adjust_eta = FALSE,
  cores = 1,
  increase_rho = list(TRUE, 100, 1),
  convergence_plot = FALSE,
  trace = FALSE,
  stop.sparse = TRUE
)

Value

Returns list with

PCAobject of type PCAloc.
PClocal loadings of PCA
gammaoptimal value for gamma.
etaoptimal value for eta.
eta_tpovalues of Trade-Off-Product for eta from optimization process.
aucarea under the curve for varying gamma values.
parsparameters and respective sparsity entrywise and mixed and explained variance.
plotggplot object for optimal parameter selection.
plot_infoadditional data for plotting functions.

Arguments

COVS

list of covariance or correlation matrices.

k

number of components to be returned.

rho

penalty parameter for ADMM.

cor

logical, if starting values for covariances or correlation matrices should be used.

eta

vector of possible values for degree of sparsity.

gamma

vector of possible values for distribution of sparsity. If only one value is provided, the optimal eta is calculated.

eps_threshold

tolerance for thresholding.

eps_root

tolerance for root finder.

eps_ADMM

tolerance for ADMM iterations.

n_max

maximal number of ADMM iterations.

adjust_eta

if eta should be adjusted for further components.

cores

number of cores for parallel computing.

increase_rho

list of settings for improved automated calculation and convergence. See Details.

convergence_plot

logical, if convergence plot should be plotted. Not applicable for cores > 1.

trace

logical, if messages should be displayed. Not applicable for cores > 1.

stop.sparse

calculate if AUC should be calculated for PCAs until full sparsity is reached (TRUE) or over the whole eta range (FALSE). Set to TRUE.

Details

The input increase_rho consists of a logical indicating if rho should be adjusted if algorithm did not converged within the given maximal number of iterations. Two integers specify the maximal rho that is allowed and the step size.

Examples

Run this code
# \donttest{
C1 = matrix(c(1,0,0,0.9), ncol = 2)
C2 = matrix(c(1.1, 0.1, 0.1, 1), ncol = 2)
C3 = matrix(c(1.2, 0.2, 0.2, 1), ncol = 2)

select_sparsity(COVS = list(C1, C2, C3),
                k = 1,
                rho = 5,
                eta = c(0, 0.1, 0.15, 0.2, 0.3, 0.4, 0.5 ,0.75,  1),
                gamma =c(0, 0.25, 0.5, 0.75, 1),
                eps_threshold = 0.005,
                increase_rho = list(FALSE, 20, 5))
# }

Run the code above in your browser using DataLab