[R] Sampling 1000 times from a bivariate normal distibution

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Tue May 4 17:34:34 CEST 2004


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
>




More information about the R-help mailing list