evaluateSfit {rags2ridges} | R Documentation |
Visual inspection of the fit of a regularized precision matrix
Description
Function aiding the visual inspection of the fit of an estimated (possibly regularized) precision matrix vis-a-vis the sample covariance matrix.
Usage
evaluateSfit(
Phat,
S,
diag = FALSE,
fileType = "pdf",
nameExt = "",
dir = getwd()
)
Arguments
Phat |
(Regularized) estimate of the precision |
S |
Sample covariance |
diag |
A |
fileType |
A |
nameExt |
A |
dir |
A |
Details
The function outputs various visualizations to aid the visual inspection of
an estimated and possibly regularized precision matrix vis-a-vis the sample
covariance matrix. The inverse of the estimated precision matrix P
is
taken to represent the estimated covariance matrix. The function then
outputs a QQ-plot and a heatmap of the observed covariances against the
estimated ones. The heatmap has the estimated covariances as
lower-triangular elements and the observed covariances as the
upper-triangular elements. The function outputs analogous plots for the
estimated and observed correlations. In case the observed covariance matrix
S
is non-singular also a QQ-plot an a heatmap are generated for the
estimated and observed partial correlations.
The function generates files with extension fileType
under default
output names. These files are stored in the directory dir
(default is
the working directory). To avoid overwriting of files when working in a
single directory one may employ the argument nameExt
. By using
nameExt
the default output names are extended with a character of
choice.
Author(s)
Wessel N. van Wieringen, Carel F.W. Peeters <carel.peeters@wur.nl>
See Also
Examples
## Not run:
## 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]
Cx <- covML(X)
## Obtain regularized precision matrix
P <- ridgeP(Cx, lambda = 10, type = 'Alt')
## Evaluate visually fit of regularized precision matrix vis-a-vis sample covariance
evaluateSfit(P, Cx, diag = FALSE, fileType = "pdf", nameExt = "test")
## End(Not run)