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.
loss(E, T, precision = TRUE, type = c("frobenius", "quadratic"))
Estimated (possibly regularized) precision matrix
.
True (population) covariance or precision matrix
.
A logical
indicating if T is a precision matrix.
A character
indicating which loss function is to be used.
Must be one of: "frobenius", "quadratic".
Function returns a numeric
representing the loss under the
chosen loss function.
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:
Squared Frobenius loss, given by: $$ L_{F}[\hat{\mathbf{\Omega}}(\lambda), \mathbf{\Omega}] = \|\hat{\mathbf{\Omega}}(\lambda) - \mathbf{\Omega}\|_{F}^{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.
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].
## 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")
#> [1] 5.107053