[R] Create correlated data with skew

Mike Lawrence Mike.Lawrence at DAL.CA
Mon Sep 17 19:17:03 CEST 2007


Hi all,

I understand that it is simple to create data with a specific  
correlation (say, .5) using mvrnorm from the MASS library:

 > library(MASS)
 > set.seed(1)
 >
 > a=mvrnorm(
+ 	n=10
+ 	,mu=rep(0,2)
+ 	,Sigma=matrix(c(1,.5,.5,1),2,2)
+ 	,empirical=T
+ )
 > a
             [,1]         [,2]
[1,] -1.0008380 -1.233467875
[2,] -0.1588633 -0.003410001
[3,]  1.2054727 -0.620558768
[4,]  1.9580971  2.389495155
[5,] -0.9447473 -0.141852055
[6,]  0.6236799 -0.826952659
[7,]  0.1421782  0.452217611
[8,] -0.9050954  0.330991444
[9,] -0.7261632  0.217740460
[10,] -0.1937206 -0.564203311
 > cor(a)
      [,1] [,2]
[1,]  1.0  0.5
[2,]  0.5  1.0


But I'm looking to create data where the variables are non-normally  
distributed (i.e. somewhat skewed). Any suggestions?

Mike

--
Mike Lawrence
Graduate Student, Department of Psychology, Dalhousie University

Website: http://memetic.ca

Public calendar: http://icalx.com/public/informavore/Public

"The road to wisdom? Well, it's plain and simple to express:
Err and err and err again, but less and less and less."
	- Piet Hein



More information about the R-help mailing list