evaluateSfit: Visual inspection of the fit of a regularized precision...

Description Usage Arguments Details Author(s) See Also Examples

View source: R/rags2ridges.R

Description

Function aiding the visual inspection of the fit of an estimated (possibly regularized) precision matrix vis-a-vis the sample covariance matrix.

Usage

1
evaluateSfit(Phat, S, diag = FALSE, fileType = "pdf", nameExt = "", dir = getwd())

Arguments

Phat

(Regularized) estimate of the precision matrix.

S

Sample covariance matrix

diag

A logical determining if the diagonal elements should be retained for plotting.

fileType

A character determining the output file type. Must be one of: "pdf", "eps".

nameExt

A character determining the extension of default output names generated by the function.

dir

A character specifying the directory in which the visual output is stored.

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 <[email protected]>

See Also

ridgeP, covML

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## 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)

CFWP/rags2ridges documentation built on Sept. 23, 2017, 6:38 a.m.