Depending on what you want your covariance matrices to be like, you could form random symmetric matrices with positive diagonals and then use nearPD {Matrix} to make them positive definite, but the resulting distribution of covariance matrices would be hard to guess. And giving a diagonal matrix to rwishart {bayesm} results in random matrices with non-zero correlations, so it's not so hard.
-- David -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robin Hankin Sent: Friday, September 26, 2008 5:10 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [R] Generating a valid covariance matrix Megh corr.matrix() in the 'emulator' package can calculate P-D variance matrices using any of a very broad class of methods. HTH rksh Megh Dal wrote: > I want to generate a valid variance-covariance matrix. One way could be to generate some random sample from multivariate normal distribution and then calculate cov. matrix. Another way could be to sample from wishart distribution itself. However both cases need a valid i.e. PD covariance matrix. As I need to generate that covariance matrix only, I am not interested those two methods. Can anyone suggest me some other way out? > > Regards, > > ______________________________________________ > R-help@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. > -- Robin K. S. Hankin Senior Research Associate Cambridge Centre for Climate Change Mitigation Research (4CMR) Department of Land Economy University of Cambridge [EMAIL PROTECTED] 01223-764877 ______________________________________________ R-help@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. ______________________________________________ R-help@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.