detect.blocks {bdsvd} | R Documentation |
Block Detection
Description
This function returns the block structure of a matrix.
Usage
detect.blocks(V, threshold = 0)
Arguments
V |
Numeric matrix which either contains the loadings or is a covariance matrix. |
threshold |
All absolute values of |
Value
An object of class Block
containing the features and columns indices corresponding to each detected block.
References
Bauer, J.O. (202Xa). High-dimensional block diagonal covariance structure detection using singular vectors.
See Also
Examples
#In the first example, we replicate the simulation study for the ad hoc procedure
#Est_0.1 from Bauer (202Xa). In the second example, we manually compute the first step
#of BD-SVD, which can be done using the bdsvd() and/or single.bdsvd(), for constructed
#sparse loadings
#Example 1: Replicate the simulation study (a) from Bauer (202Xa) for the ad hoc
#procedure Est_0.1.
p <- 500 #Number of variables
n <- 125 #Number of observations
b <- 500 #Number of blocks
design <- "a"
#Simulate data matrix X
set.seed(1)
Sigma <- bdsvd.cov.sim(p = p, b = b, design = design)
X <- mvtnorm::rmvnorm(n, mean=rep(0, p), sigma=Sigma)
colnames(X) <- 1:p
#Perform the ad hoc procedure
detect.blocks(cvCovEst::scadEst(dat = X, lambda = 0.2), threshold = 0)
#Example 2: Manually compute the first step of BD-SVD
#for some loadings V that mirror the two blocks
#("A", "B") and c("C", "D").
V <- matrix(c(1,0,
1,0,
0,1,
0,1), 4, 2, byrow = TRUE)
rownames(V) <- c("A", "B", "C", "D")
detected.blocks <- detect.blocks(V)
#Variables in block one with corresponding column index:
detected.blocks[[1]]@features
detected.blocks[[1]]@block.columns
#Variables in block two with corresponding column index:
detected.blocks[[2]]@features
detected.blocks[[2]]@block.columns
[Package bdsvd version 0.2.0 Index]