sparsePCAloc: Calculate Sparse Principle Components

View source: R/sparsePCAloc.R

sparsePCAlocR Documentation

Calculate Sparse Principle Components

Description

Calculate Sparse Principle Components

Usage

sparsePCAloc(
  eta,
  gamma,
  COVS,
  cor = FALSE,
  rho = NULL,
  k = NULL,
  eps_threshold = NULL,
  eps_ADMM = 1e-04,
  n_max = 200,
  eps_root = 0.1,
  maxiter_root = 50,
  increase_rho = list(TRUE, 100, 1),
  convergence_plot = TRUE,
  starting_value = NULL,
  adjust_eta = TRUE,
  trace = TRUE
)

Arguments

eta

numeric, degree of sparsity.

gamma

numeric, distribution of sparsity.

COVS

list of covariance or correlation matrices.

cor

logical, if starting value for correlation or covariance matrices should be used.

rho

numeric bigger than zero, penalty for ADMM.

k

number of components to calculate.

eps_threshold

tolerance for thresholding.

eps_ADMM

tolerance for ADMM convergence.

n_max

number of maximal iterations.

eps_root

tolerance for root finder.

maxiter_root

maximal number of iterations for root finder.

increase_rho

list with entries for stable convergence. See Details.

convergence_plot

logical, if convergence plot should be displayed.

starting_value

optional given starting value.

adjust_eta

logical, if eta should be adjusted by the variance.

trace

logical, if messages should be displayed.

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.

Value

An object of class "PCAloc" containing the following elements:

PC Matrix of dimension Np x k of stacked loading vectors.
p Number of variables.
N Number of neighborhoods.
k Number of components.
COVS List of covariance matrices sorted by neighborhood.
gamma Sparsity distribution.
eta Amount of sparsity.
converged Logical, if ADMM converged with given specifications.
n_steps Number of steps used.
summary Description of result per component.
residuals Primary and secondary residuals.

Examples

C1 = diag(c(1.1, 0.9, 0.6))
C2 = matrix(c(1.1, 0.1, -0.1,
              0.1, 1.0, -0.2,
             -0.1, -0.2, 0.7), ncol = 3)
C3 = (C1 + C2)/2

sparsePCAloc(eta = 1, gamma = 0.5, cor = FALSE, COVS = list(C1, C2, C3),
             n_max = 100, increase_rho = list(FALSE, 100, 1))


ssMRCD documentation built on Sept. 11, 2024, 5:14 p.m.