Skip to content

Instantly share code, notes, and snippets.

View berndweiss's full-sized avatar

Bernd Weiss berndweiss

View GitHub Profile
@berndweiss
berndweiss / gist:823292
Created February 11, 2011 23:50
Using R to simulate correlated data which is not standard-normally distributed
library(MASS)
## let's assume that
## X ~ N(1.0, 1.5)
## Y ~ N(2.0, 2.1)
## Z ~ N(0.5, 1.0)
## r_XY = 0.2, r_XZ = 0.4, r_YZ = -0.3
## create a vector of standard diviations
std <- c(1.5, 2.1, 1.0)