sparsity_entries: Entry-wise Sparsity in the Loadings

View source: R/sparsePCA_helpers.R

sparsity_entriesR Documentation

Entry-wise Sparsity in the Loadings

Description

Entry-wise Sparsity in the Loadings

Usage

sparsity_entries(PC, N, p, tolerance = 0, k = 1, scaled = TRUE)

Arguments

PC

matrix-like object of PCs.

N

integer, number of groups.

p

integer, number of variables.

tolerance

tolerance for sparsity.

k

integer or integer vector of which component should be used.

scaled

logical, if total number or percentage of possible sparse entries should be returned.

Value

Returns either a percentage (scaled = TRUE) or the amount of zero-values entries (scaled = FALSE).

Examples

PC = matrix(c(1,0,2,3,0,7,0,1,0,1,0.001,0), ncol = 2)
sparsity_entries(PC, N = 2, p = 3, tolerance = 0, k = 1, scaled = FALSE)
sparsity_entries(PC, N = 2, p = 3, tolerance = 0.001, k = 2, scaled = TRUE)


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