[R] Simulate dichotomous correlation matrix

From: Bliese, Paul D LTC USAMH <paul.bliese_at_us.army.mil>
Date: Wed 28 Jun 2006 - 21:31:55 EST

Newsgroup members,

Does anyone have a clever way to simulate a correlation matrix such that each column contains dichotomous variables (0,1) and where each column has different prevalence rates.

For instance, I would like to simulate the following correlation matrix:

> CORMAT[1:4,1:4]

PUREPT   1.0000000 0.5141552 0.1913139 0.1917923
PTCUT2   0.5141552 1.0000000 0.2913552 0.2204097
PHQCUT2T 0.1913139 0.2913552 1.0000000 0.1803987
ALCCUTT2 0.1917923 0.2204097 0.1803987 1.0000000

Where the prevalence for each variable is:

> prevvals=c(0.26,0.10,0.09,0.10)

I can use the mvrnorm function in MASS to create a matrix containing random normal variables and dichotomize these variables into 0,1; however, this is a less than ideal solution as my observed correlation matrix is downwardly biased and the amount of the bias is related to the prevalence of each variable.


Paul D. Bliese
Heidelberg, Germany
COMM: +49-6221-172626

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jun 29 01:03:35 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 29 Jun 2006 - 02:13:52 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.