Sung Kim
2004-May-04 15:21 UTC
[R] Sampling 1000 times from a bivariate normal distibution
Dear expert, I have two coefficients and covariance matrix. My objective is sampling 1000 times from the mean and covariance matrix. In order to get that, what kind of commend should I use? If you do not mind, could you tell me the comment in detail about parameter used in that commend also? Thank you. Sung. [[alternative HTML version deleted]]
Achim Zeileis
2004-May-04 15:34 UTC
[R] Sampling 1000 times from a bivariate normal distibution
On Tue, 04 May 2004 11:21:37 -0400 Sung Kim wrote:> Dear expert, > > I have two coefficients and covariance matrix. > > My objective is sampling 1000 times from the mean and covariance > matrix. > > In order to get that, what kind of commend should I use? > > If you do not mind, could you tell me the comment in detail about > parameter used in that commend also? >Look at rmvnorm in package mvtnorm: library(mvtnorm) help(rmvnorm) m <- c(10, 40) S <- matrix(c(10, 80, 80, 30), ncol = 2) x <- rmvnorm(n = 1000, mean = m, sigma = S) plot(x) hth Z> > Thank you. > > > > Sung. > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html >
Roger D. Peng
2004-May-04 15:38 UTC
[R] Sampling 1000 times from a bivariate normal distibution
The MASS library has the function mvrnorm() which you should be able to use. -roger Sung Kim wrote:> Dear expert, > > > > I have two coefficients and covariance matrix. > > > > My objective is sampling 1000 times from the mean and covariance matrix. > > > > In order to get that, what kind of commend should I use? > > > > If you do not mind, could you tell me the comment in detail about > parameter used in that commend also? > > > > Thank you. > > > > Sung. > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >