Good day, I was looking through some papers to help with my project assignment that wants me to implements 2 lasso approaches. I am having trouble simulating the samples from a MVN distribution.
$\Theta = B + δI_p \in R_{p\times p}$, where $I_p$ is the identity matrix, each off-diagonal entry in $B$ (symmetric matrix) is generated independently and equals $0.5$ with probability $0.1$ or $0$ with probability $0.9$. $\delta > 0 $is chosen such that $\Theta$ is positive definite. Finally, the matrix is standardized to have unit diagonals (transforming from covariance matrix to correlation matrix). The sparsity pattern in $\Theta$ corresponds to the true edge set $E=\{ (j,l):c_{jl}\neq0, 1 \leq j,l \leq p,j\neq l\}$.
I had a look at some papers that generated this matrix but I had no luck in finding the code. I assume I have to use scio and glasso packages for this from what I gathered and then apply mvrnorn to generate the samples.
EDIT:
Having attempted this, I think I managed to generate the matrix $B$ as described.
set.seed(123)
m = matrix(NA, ncol = 100, nrow = 100)
m[lower.tri(m)] = 0.5*rbinom(100*(100-1)/2,1,0.1)
m[upper.tri(m)] = 0.5*rbinom(100*(100-1)/2,1,0.1)
diag(m) = 0
theta=nearPD(m, keepDiag=FALSE)
I also used the nearPD function to get the $\Theta$ matrix. But I am not sure how I can do this without using a prebuilt function. i.e. use the format of the question $\Theta = B + δI_p \in R_{p\times p}$ and find a suitable $\delta$.
How do I find this $\delta$?