Santiago Barreda
Postdoctoral Researcher, Dept. of Physiology, University of Arizona

Main Research Vignettes CV phonTools Statistics Links

 


rmvtnorm [phonTools]


This function generates random variables from a multivariate normal distribution as specified by the user. The number of draws, correlation between dimensions, and the number of dimensions is determined by the user. In the example below, 10000 samples have been taken from bivariate normal distributions with different correlations, indicated in the main label of each panel.

 

 

Code used to generate examples:


library (phonTools) par (mfrow = c(3,3), mar = c(4,4,2,1)) ## Examples of draws from different bivariate normal distributions ## and standard deviation ellipses drawn to fit them. for (i in seq (-.9, .9, length.out = 9)){ draws = rmvtnorm (n = 10000, k = 2, sigma = i) plot (draws, cex = .5, pch = 15, xlim = c(-4,4), ylim = c(-4,4), xlab='', ylab='', main = paste ('r =',i)) sdellipse (draws, stdev = 3, lwd = 3, col = 2) }