Re: How to create conditional correlated random values given exogenous data
- From: "Ray Koopman" <koopman@xxxxxx>
- Date: 7 Nov 2006 16:56:40 -0800
Ray Koopman wrote:
1. Get the cholesky factor, say A, of the desired 5 x 5 covariance
matrix whose first 2 variables are the given X-variables.
2. Get the QR decomposition of the n x 6 matrix in which
column 1 is all 1's,
columns 2 & 3 are the two given X-variables,
columns 4, 5, & 6 are filled with independent identically
distributed random normal values.
3. Y = sqrt[m]*(the last 3 columns of Q)*
(the transpose of the lower right 3 x 3 section of A),
where m is either n or n-1, depending on how you define variance.
Step 3 is wrong. Try this instead:
If R[2,2] < 0 then Q[1:n,2] = -Q[1:n,2]
If R[3,3] < 0 then Q[1:n,3] = -Q[1:n,3]
Y = sqrt[m] * Q[1:n,2:6] * Transpose[A[3:5,1:5]]
.
- Follow-Ups:
- References:
- Prev by Date: Re: Testing the Equality of Two Population Proportions
- Next by Date: Re: Testing the Equality of Two Population Proportions
- Previous by thread: Re: How to create conditional correlated random values given exogenous data
- Next by thread: Re: How to create conditional correlated random values given exogenous data
- Index(es):