Generating data in the desired correlation structure from the multivariate normal distribution in R I want to derive 200 variables from the multivariate normal distribution. I will divide these 200 variables into 3 blocks. The 1st block will consist of 40 variables and will be low-moderately correlated with each other (0.30-0.40 maximum). The 2nd block will also consist of 30 variables, which will also be low-moderately correlated with each other (0.30-0.40 maximum). The correlation between the variables in block 1 and block 2 will be high (around 0.60-0.70). The remaining variables will form block 3 and the variables in this block will have very low correlation both with each other and with other blocks (maximum 0.1). How can I derive such a derivation without getting stuck with the non-positive definite matrix problem? I tried a way as below, but I encountered a non-positive definite matrix problem. request your valuable help.
rho1=0.1
rho2=0.7
rho3=0.01
blck1= 1:40
blck2= 41:70

Sigma <- diag(200)
Sigma[c(blck1, blck2), ] <- rho1
Sigma[blck2, blck1] <- rho2
Sigma[-c(blck1, blck2), ] <- rho3
diag(Sigma) <- 1
Sigma[upper.tri(Sigma)] <- t(Sigma)[upper.tri(Sigma)]
Sigma


Scaling a non-positive definite correlation matrix to ensure that it is positive definite is called smoothing.
Here's a paper that describes a method to do it: https://link.springer.com/article/10.1007/s11336-010-9191-3
Here is an R function that implements the method: https://rdrr.io/cran/fungible/man/smoothBY.html
