Dear ALL
I want to simulate data from Multivariate normal distribution.
GE.N<-mvrnorm(25,mu,S)
S <-matrix(rep(0,10000),nrow=100)
for( i in 1:100){sigma<-runif(100,0.1,10);S
[i,i]=sigma[i];mu<-runif(100,0,10)}
for (i in 1:20){for (j in 1:20){if (i != j){S [i,j]=0.3*sigma[i]*sigma[j]}}}
for (i in 21:40){for (j in 21:40){if (i != j){S
[i,j]=0.3*sigma[i]*sigma[j]}}}
for (i in 41:60){for (j in 41:60){if (i != j){S
[i,j]=0.3*sigma[i]*sigma[j]}}}
for (i in 61:80){for (j in 61:80){if (i != j){S
[i,j]=0.3*sigma[i]*sigma[j]}}}
for (i in 81:100){for (j in 81:100){if (i != j){S
[i,j]=0.3*sigma[i]*sigma[j]}}}
How should I do when S is not positive definite matrix?
I saw this error: 'Sigma' is not positive definite.
best regards,
Gulia
[[alternative HTML version deleted]]