Function that determines the support of a partial correlation/precision matrix by thresholding and sparsifies it accordingly.
sparsify(
P,
threshold = c("absValue", "connected", "localFDR", "top"),
absValueCut = 0.25,
FDRcut = 0.9,
top = 10,
output = "heavy",
verbose = TRUE
)
If the input P
is a standardized precision (or partial
correlation) matrix the function returns a sparsified precision (or partial
correlation) matrix
whenever output = "heavy"
. If the input
P
is an unstandardized precision matrix the function returns an
object of class list
whenever output = "heavy"
:
A matrix
representing the sparsified partial
correlation matrix.
A matrix
representing the
sparsified precision matrix.
When output = "light"
, only the (matrix) positions of the zero and
non-zero elements are returned in an object of class list
:
A matrix
representing the row and column positions of
zero entries.
A matrix
representing the row and
column positions of non-zero entries.
(Possibly regularized) precision matrix
.
A character
signifying type of sparsification by
thresholding. Must be one of: "absValue", "connected", "localFDR", "top".
A numeric
giving the cut-off for partial
correlation element selection based on absolute value thresholding.
A numeric
giving the cut-off for partial correlation
element selection based on local false discovery rate (FDR) thresholding.
A numeric
specifying the exact number of partial
correlation elements to retain based on absolute value.
A character
specifying the type of output required.
Must be one of: "heavy", "light".
A logical
indicating if intermediate output should be
printed on screen.
Carel F.W. Peeters <carel.peeters@wur.nl>, Wessel N. van Wieringen
The function transforms the possibly regularized input precision matrix to a
partial correlation matrix. Subsequently, the support of this partial
correlation matrix is determined. Support determination is performed either
by simple thresholding on the absolute values of matrix entries
(threshold = "absValue"
) or by usage of local FDR (threshold =
"localFDR"
). A third option is to retain a prespecified number of matrix
entries based on absolute values. For example, one could wish to retain
those entries representing the ten strongest absolute partial correlations
(threshold = "top"
). As a variation on this theme, a fourth option
(threshold = "connected"
) retains the top edges such that the
resulting graph is connected (this may result in dense graphs in practice).
The argument absValueCut
is only used when threshold =
"absValue"
. The argument top
is only used when threshold =
"top"
. The argument FDRcut
is only used when threshold =
"localFDR"
.
The function is to some extent a wrapper around certain
fdrtool functions when
threshold = "localFDR"
. In that case a mixture model is fitted to the
nonredundant partial correlations by
fdrtool. The decision to
retain elements is then based on the argument FDRcut
. Elements with a
posterior probability \(\geq\) FDRcut (equalling 1 - local FDR) are
retained. See Schaefer and Strimmer (2005) for further details on usage of
local FDR in graphical modeling.
Schaefer, J., and Strimmer, K. (2005). A shrinkage approach to large-scale covariance estimation and implications for functional genomics. Statistical Applications in Genetics and Molecular Biology, 4:32.
ridgeP
, optPenalty.aLOOCV
,
optPenalty.LOOCV
## Obtain some (high-dimensional) data
p = 25
n = 10
set.seed(333)
X = matrix(rnorm(n*p), nrow = n, ncol = p)
colnames(X)[1:25] = letters[1:25]
## Obtain regularized precision under optimal penalty
OPT <- optPenalty.LOOCV(X, lambdaMin = .5, lambdaMax = 30, step = 100)
## Determine support regularized (standardized) precision under optimal penalty
sparsify(OPT$optPrec, threshold = "localFDR")
Run the code above in your browser using DataLab