I want to conduct a Monte-Carlo simulation of a repeated-measures ANOVA. The random numbers used for the simulation need to have specified mean values, standard deviations and correlations between the levels of the repeated-measures variable.

Generating random nubers with a specified correlation matrix is not the problem. I do this using a Cholesky decomposition of the correlation matrix with which the (normally distributed) random numbers are multiplied.

A problem occurs if there are both between-subjects and within-subject variables, e.g.,

AB

CD

with the columns (AC and BD) being the levels of a within-subject variable and the rows (AB and CD) being levels of a between-subjects variable. The columns must have a specified correlation (e.g., 0.5), but the mean values and standard deviations of A, C, B, and D must be different. If I start generating normally distributed random numbers for column AC and BD and then multiply the two columns with a Cholesky-decomposited correlation matrix, the correlation between both columns is correct (0.5). However, as soon as I add different expectation values to A and C or B and D the correlation changes.

So my question is: How can I generate random numbers that have a specified correlation between columns

Thank you very much,

Kes ]]>