| grasps | R Documentation |
Provide a collection of statistical methods that incorporate both element-wise and group-wise penalties to estimate a precision matrix.
grasps(
X,
n = nrow(X),
membership,
penalty,
diag.ind = TRUE,
diag.grp = TRUE,
diag.include = FALSE,
lambda = NULL,
alpha = NULL,
gamma = NULL,
nlambda = 10,
lambda.min.ratio = 0.01,
growiter.lambda = 30,
tol.lambda = 0.001,
maxiter.lambda = 50,
rho = 2,
tau.incr = 2,
tau.decr = 2,
nu = 10,
tol.abs = 1e-04,
tol.rel = 1e-04,
maxiter = 10000,
crit = "BIC",
kfold = 5,
ebic.tuning = 0.5
)
X |
|
n |
An integer (default = |
membership |
An integer vector specifying the group membership.
The length of |
penalty |
A character string specifying the penalty for estimating precision matrix. Available options include:
|
diag.ind |
A logical value (default = TRUE) specifying whether to penalize the diagonal elements. |
diag.grp |
A logical value (default = TRUE) specifying whether to penalize the within-group blocks. |
diag.include |
A logical value (default = FALSE) specifying whether to
include the diagonal entries in the penalty for within-group blocks when
|
lambda |
A non-negative numeric vector specifying the grid for
the regularization parameter. The default is |
alpha |
A numeric vector in [0, 1] specifying the grid for the mixing parameter balancing the element-wise individual L1 penalty and the block-wise group L2 penalty. An alpha of 1 corresponds to the individual penalty only; an alpha of 0 corresponds to the group penalty only. The default value is a sequence from 0.1 to 0.9 with increments of 0.1. |
gamma |
A numeric value specifying the additional parameter fo
the chosen
|
nlambda |
An integer (default = 10) specifying the number of
|
lambda.min.ratio |
A numeric value > 0 (default = 0.01) specifying
the fraction of the maximum |
growiter.lambda |
An integer (default = 30) specifying the maximum
number of exponential growth steps during the initial search for an
admissible upper bound |
tol.lambda |
A numeric value > 0 (default = 1e-03) specifying the relative tolerance for the bisection stopping rule on the interval width. |
maxiter.lambda |
An integer (default = 50) specifying the maximum number
of bisection iterations in the line search for |
rho |
A numeric value > 0 (default = 2) specifying the ADMM augmented-Lagrangian penalty parameter (often called the ADMM step size). Larger values typically put more weight on enforcing the consensus constraints at each iteration; smaller values yield more conservative updates. |
tau.incr |
A numeric value > 1 (default = 2) specifying
the multiplicative factor used to increase |
tau.decr |
A numeric value > 1 (default = 2) specifying
the multiplicative factor used to decrease |
nu |
A numeric value > 1 (default = 10) controlling how aggressively
|
tol.abs |
A numeric value > 0 (default = 1e-04) specifying the absolute tolerance for ADMM stopping (applied to primal/dual residual norms). |
tol.rel |
A numeric value > 0 (default = 1e-04) specifying the relative tolerance for ADMM stopping (applied to primal/dual residual norms). |
maxiter |
An integer (default = 1e+04) specifying the maximum number of ADMM iterations. |
crit |
A character string (default = "BIC") specifying the parameter selection criterion to use. Available options include:
|
kfold |
An integer (default = 5) specifying the number of folds used for
|
ebic.tuning |
A numeric value in [0, 1] (default = 0.5) specifying
the tuning parameter to calculate for |
An object with S3 class "grasps" containing the following components:
The estimated precision matrix.
The optimal regularization parameter.
The optimal mixing parameter.
The initial estimate of hatOmega when a non-convex
penalty is chosen via penalty.
The optimal addtional parameter when a non-convex penalty
is chosen via penalty.
The number of ADMM iterations.
The actual lambda grid used in the program.
The actual alpha grid used in the program.
The bisection-refined upper bound \lambda_{\max},
corresponding to alpha.grid, when lambda = NULL.
The optimal k-fold loss when crit = "CV".
Matrix of CV losses, with rows for parameter combinations and
columns for CV folds, when crit = "CV".
The optimal information criterion score when crit is set
to "AIC", "BIC", "EBIC", or "HBIC".
The information criterion score for each parameter
combination when crit is set to "AIC", "BIC",
"EBIC", or "HBIC".
The group membership.
library(grasps)
## reproducibility for everything
set.seed(1234)
## block-structured precision matrix based on SBM
sim <- gen_prec_sbm(d = 30, K = 3,
within.prob = 0.25, between.prob = 0.05,
weight.dists = list("gamma", "unif"),
weight.paras = list(c(shape = 20, rate = 10),
c(min = 0, max = 5)),
cond.target = 100)
## visualization
plot(sim)
## n-by-d data matrix
library(MASS)
X <- mvrnorm(n = 20, mu = rep(0, 30), Sigma = sim$Sigma)
## adapt, HBIC
res <- grasps(X = X, membership = sim$membership, penalty = "adapt", crit = "HBIC")
## visualization
plot(res)
## performance
performance(hatOmega = res$hatOmega, Omega = sim$Omega)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.