View source: R/ridgePgenAndCo.R
ridgePgen | R Documentation |
Function that evaluates the generalized ridge estimator of the inverse covariance matrix with element-wise penalization and shrinkage.
ridgePgen(S, lambda, target, nInit=100, minSuccDiff=10^(-10))
S |
Sample covariance |
lambda |
A symmetric |
target |
A semi-positive definite target |
nInit |
A |
minSuccDiff |
A |
This function generalizes the ridgeP
-function in the sense that, besides element-wise shrinkage, it allows for element-wise penalization in the estimation of the precision matrix of a zero-mean multivariate normal distribution. Hence, it assumes that the data stem from \mathcal{N}(\mathbf{0}_p, \boldsymbol{\Omega}^{-1})
. The estimator maximizes the following penalized loglikelihood:
\log( | \boldsymbol{\Omega} |) - \mbox{tr} ( \boldsymbol{\Omega} \mathbf{S} ) - \| \boldsymbol{\Lambda} \circ (\boldsymbol{\Omega} - \mathbf{T}) \|_F^2,
where \mathbf{S}
the sample covariance matrix, \boldsymbol{\Lambda}
a symmetric, positive matrix of penalty parameters, the \circ
-operator represents the Hadamard or element-wise multipication, and \mathbf{T}
the precision matrix' shrinkage target. For more details see van Wieringen (2019).
The function returns a regularized inverse covariance matrix
.
W.N. van Wieringen.
van Wieringen, W.N. (2019), "The generalized ridge estimator of the inverse covariance matrix", Journal of Computational and Graphical Statistics, 28(4), 932-942.
ridgeP
.
# set dimension and sample size
p <- 10
n <- 10
# penalty parameter matrix
lambda <- matrix(1, p, p)
diag(lambda) <- 0.1
# generate precision matrix
Omega <- matrix(0.4, p, p)
diag(Omega) <- 1
Sigma <- solve(Omega)
# data
Y <- mvtnorm::rmvnorm(n, mean=rep(0,p), sigma=Sigma)
S <- cov(Y)
# unpenalized diagonal estimate
Phat <- ridgePgen(S, lambda, 0*S)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.