loss {rags2ridges}R Documentation

Evaluate regularized precision under various loss functions

Description

Function that evaluates an estimated and possibly regularized precision matrix under various loss functions. The loss functions are formulated in precision terms. This function may be used to estimate the risk (vis-a-vis, say, the true precision matrix) of the various ridge estimators employed.

Usage

loss(E, T, precision = TRUE, type = c("frobenius", "quadratic"))

Arguments

E

Estimated (possibly regularized) precision matrix.

T

True (population) covariance or precision matrix.

precision

A logical indicating if T is a precision matrix.

type

A character indicating which loss function is to be used. Must be one of: "frobenius", "quadratic".

Details

Let \mathbf{\Omega} denote a generic (p \times p) population precision matrix and let \hat{\mathbf{\Omega}}(\lambda) denote a generic ridge estimator of the precision matrix under generic regularization parameter \lambda (see also ridgeP). The function then considers the following loss functions:

  1. Squared Frobenius loss, given by:

    L_{F}[\hat{\mathbf{\Omega}}(\lambda), \mathbf{\Omega}] = \|\hat{\mathbf{\Omega}}(\lambda) - \mathbf{\Omega}\|_{F}^{2};

  2. Quadratic loss, given by:

    L_{Q}[\hat{\mathbf{\Omega}}(\lambda), \mathbf{\Omega}] = \|\hat{\mathbf{\Omega}}(\lambda) \mathbf{\Omega}^{-1} - \mathbf{I}_{p}\|_{F}^{2}.

The argument T is considered to be the true precision matrix when precision = TRUE. If precision = FALSE the argument T is considered to represent the true covariance matrix. This statement is needed so that the loss is properly evaluated over the precision, i.e., depending on the value of the logical argument precision inversions are employed where needed.

The function can be employed to assess the risk of a certain ridge precision estimator (see also ridgeP). The risk \mathcal{R}_{f} of the estimator \hat{\mathbf{\Omega}}(\lambda) given a loss function L_{f}, with f \in \{F, Q\} can be defined as the expected loss:

\mathcal{R}_{f}[\hat{\mathbf{\Omega}}(\lambda)] = \mathrm{E}\{L_{f}[\hat{\mathbf{\Omega}}(\lambda), \mathbf{\Omega}]\},

which can be approximated by the mean or median of losses over repeated simulation runs.

Value

Function returns a numeric representing the loss under the chosen loss function.

Author(s)

Carel F.W. Peeters <carel.peeters@wur.nl>, Wessel N. van Wieringen

References

van Wieringen, W.N. & Peeters, C.F.W. (2016). Ridge Estimation of Inverse Covariance Matrices from High-Dimensional Data, Computational Statistics & Data Analysis, vol. 103: 284-303. Also available as arXiv:1403.0904v3 [stat.ME].

See Also

covML, ridgeP

Examples


## Define population covariance
set.seed(333)
p = 25
n = 1000
X = matrix(rnorm(n*p), nrow = n, ncol = p)
colnames(X)[1:25] = letters[1:25]
Truecov <- covML(X)

## Obtain sample
samples <- X[sample(nrow(X), 10), ]
Cxx <- covML(samples)

## Obtain regularized precision
P <- ridgeP(Cxx, 10, type = "Alt")

## Evaluate estimated precision against population
## precision under Frobenius loss
loss(P, Truecov, precision = FALSE, type = "frobenius")


[Package rags2ridges version 2.2.7 Index]