SimulatePrecision {fake} | R Documentation |
Simulation of precision matrix
Description
Simulates a sparse precision matrix from a binary adjacency matrix
theta
encoding conditional independence in a Gaussian Graphical Model.
Usage
SimulatePrecision(
pk = NULL,
theta,
v_within = c(0.5, 1),
v_between = c(0, 0.1),
v_sign = c(-1, 1),
continuous = TRUE,
pd_strategy = "diagonally_dominant",
ev_xx = NULL,
scale = TRUE,
u_list = c(1e-10, 1),
tol = .Machine$double.eps^0.25
)
Arguments
pk |
vector of the number of variables per group in the simulated
dataset. The number of nodes in the simulated graph is |
theta |
binary and symmetric adjacency matrix encoding the conditional independence structure. |
v_within |
vector defining the (range of) nonzero entries in the
diagonal blocks of the precision matrix. These values must be between -1
and 1 if |
v_between |
vector defining the (range of) nonzero entries in the
off-diagonal blocks of the precision matrix. This argument is the same as
|
v_sign |
vector of possible signs for precision matrix entries. Possible
inputs are: |
continuous |
logical indicating whether to sample precision values from
a uniform distribution between the minimum and maximum values in
|
pd_strategy |
method to ensure that the generated precision matrix is
positive definite (and hence can be a covariance matrix). If
|
ev_xx |
expected proportion of explained variance by the first Principal
Component (PC1) of a Principal Component Analysis. This is the largest
eigenvalue of the correlation (if |
scale |
logical indicating if the proportion of explained variance by
PC1 should be computed from the correlation ( |
u_list |
vector with two numeric values defining the range of values to explore for constant u. |
tol |
accuracy for the search of parameter u as defined in
|
Details
Entries that are equal to zero in the adjacency matrix theta
are also equal to zero in the generated precision matrix. These zero
entries indicate conditional independence between the corresponding pair of
variables (see SimulateGraphical
).
Argument pk
can be specified to create groups of variables and allow
for nonzero precision entries to be sampled from different distributions
between two variables belonging to the same group or to different groups.
If continuous=FALSE
, nonzero off-diagonal entries of the precision
matrix are sampled from a discrete uniform distribution taking values in
v_within
(for entries in the diagonal block) or v_between
(for entries in off-diagonal blocks). If continuous=TRUE
, nonzero
off-diagonal entries are sampled from a continuous uniform distribution
taking values in the range given by v_within
or v_between
.
Diagonal entries of the precision matrix are defined to ensure positive
definiteness as described in MakePositiveDefinite
.
Value
A list with:
omega |
true simulated precision matrix. |
u |
value of the constant u used to ensure that |
References
Bodinier B, Filippi S, Nost TH, Chiquet J, Chadeau-Hyam M (2021). “Automated calibration for stability selection in penalised regression and graphical models: a multi-OMICs network application exploring the molecular response to tobacco smoking.” https://arxiv.org/abs/2106.02521.
See Also
SimulateGraphical
, MakePositiveDefinite
Examples
# Simulation of an adjacency matrix
theta <- SimulateAdjacency(pk = c(5, 5), nu_within = 0.7)
print(theta)
# Simulation of a precision matrix maximising the contrast
simul <- SimulatePrecision(theta = theta)
print(simul$omega)
# Simulation of a precision matrix with specific ev by PC1
simul <- SimulatePrecision(
theta = theta,
pd_strategy = "min_eigenvalue",
ev_xx = 0.3, scale = TRUE
)
print(simul$omega)