I'm completing an assignment, in which I have to generate a sample X = (X1, X2) from a bivariate normal in which each marginal is N(0,1) and the correlation between X1 and X2 is 0.5. I think the way to approach this is to use the mvrnorm function, but I'm not quite sure how to proceed after that. Any advice? Thanks in advance!
16.7k 18 18 gold badges 42 42 silver badges 62 62 bronze badges asked Jan 31, 2020 at 4:37 397 1 1 gold badge 3 3 silver badges 11 11 bronze badgesIndeed, the mvrnorm function from the MASS package is probably your best bet. This function can generate pseudo-random data from multivariate normal distributions.
Examining the help page for this function ( ??mvrnorm ) shows that there are three key arguments that you would need to simulate your data based your given parameters, ie:
Have a look at the examples in this help page, which should help you put these ideas together!