Learn R Programming

ssMRCD (version 1.1.0)

sparsity_group: Group-wise Sparsity in the Loadings

Description

Group-wise Sparsity in the Loadings

Usage

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

Value

Returns either a matrix of percentages (scaled = TRUE) or the amounts of zero-values entries (scaled = FALSE) for each group/neighborhood.

Arguments

PC

matrix-like object of PCs.

N

integer, number of groups.

p

integer, number of variables.

tolerance

tolerance for sparsity.

k

integer, which components should be used. Does not work for multiple PCs simultaneously.

scaled

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

Examples

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

Run the code above in your browser using DataLab