From: Stat Consult <statconsult90_at_gmail.com>

Date: Mon, 30 May 2011 15:56:07 +0430

R-help_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 30 May 2011 - 12:26:20 GMT

Date: Mon, 30 May 2011 15:56:07 +0430

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]]

R-help_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 30 May 2011 - 12:26:20 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Mon 30 May 2011 - 12:30:12 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*