R/rags2ridgesVariants.r
ridgePsign.Rd
Function that calculates the ridge estimators for high-dimensional precision matrices with known sign of the off-diagonal precision elements.
ridgePsign(
S,
lambda,
sign,
target = default.target(S),
type = "Alt",
method = "nlm",
verbose = TRUE,
...
)
Sample covariance matrix
.
A numeric
representing the value of the penalty
parameter.
A character indicating the required sign of the off-diagonal elements of ridge precision estimate. Must be either: "pos" (positive) and "neg" (negative).
A target matrix
(in precision terms) for the ridge
precision estimator.
A character
indicating the type of ridge estimator to be
used. Must be one of: "Alt", "ArchI", "ArchII".
A character
: which optimization function should be
used: "nlm"
(default) or "optim"
which refer to
nlminb
or
constrOptim
, respectively.
Logical
indicator: should intermediate output be
printed on the screen?
Additional arguments passed on to either
nlminb
or
constrOptim
.
The function returns a regularized precision matrix
with
off-diagonal elements of specified signed or zero.
Modified version of the ridgePchordal
-function, now the ridge
precision matrix estimate has off-diagonal elements equalling zero or of the
specified sign. The estimate is found by solving a constrained estimation
problem. This is done numerically and employs the
nlminb
and
constrOptim
procedure of R. These
procedures are initiated by the ridge ML precision estimate and its
off-diagonal elements with the excluded sign set to (effectively) zero.
# obtain some data
p <- 8
n <- 100
set.seed(333)
Y <- matrix(rnorm(n*p), nrow = n, ncol = p)
# obtain regularized precision matrix with off-diagonal elements of specified signed
ridgePsign(covML(Y), lambda=0.1, sign="pos")
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7]
#> [1,] 1.10677331 0.00000 0.04470788 0.00000000 0.000000 0.01444850 0.00000000
#> [2,] 0.00000000 1.11899 0.00000000 0.00000000 0.000000 0.00000000 0.00000000
#> [3,] 0.04470788 0.00000 1.19493103 0.00000000 0.000000 0.13846365 0.17012323
#> [4,] 0.00000000 0.00000 0.00000000 0.95127218 0.000000 0.00000000 0.04376561
#> [5,] 0.00000000 0.00000 0.00000000 0.00000000 1.120341 0.00000000 0.00000000
#> [6,] 0.01444850 0.00000 0.13846365 0.00000000 0.000000 0.94358811 0.00000000
#> [7,] 0.00000000 0.00000 0.17012323 0.04376561 0.000000 0.00000000 1.29009913
#> [8,] 0.00000000 0.00000 0.16437939 0.05358874 0.000000 0.08897917 0.01493089
#> [,8]
#> [1,] 0.00000000
#> [2,] 0.00000000
#> [3,] 0.16437939
#> [4,] 0.05358874
#> [5,] 0.00000000
#> [6,] 0.08897917
#> [7,] 0.01493089
#> [8,] 0.94072961