Generating Correlated Random Variables Bivariate Gaussian Distribution The joint (bivariate) PDF for X 1,2 is f X 1 X 2 (x 1 ,x 2 )= 1 2π 1 (1 - ρ 2 ) 1/2 exp - 1 2(1 - ρ 2 ) x 2 1 σ 2 1 + x 2 2 σ 2 2 - 2ρ x 1 x 2 σ 1 σ 2 A more useful of writing this PDF is to use the column vector X = col (X 1 ,X 2 ) and the covariance matrix C = σ 2 1 σ 1 σ 2 ρ σ 1 σ 2 ρ σ 2 2 to write (using † to denote transpose) f X (X)= 1 2π (det C) 1/2 exp - 1 2 X † C -1 X . The bivariate Gaussian is used frequently in likelihood and Bayesian estimation to display contours for parameter estimates. 1
4
Embed
Generating Correlated Random Variables - Cornell Universityhosting.astro.cornell.edu/.../GeneratingCorrelatedRandomVariables.pdf · Generating Correlated Random Variables Bivariate
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Generating Correlated Random Variables
Bivariate Gaussian Distribution
The joint (bivariate) PDF for X1,2 is
fX1X2(x1, x2) =1
2π
1
(1− ρ2)1/2exp
− 1
2(1− ρ2)
x21σ21
+x22σ22− 2ρ
x1x2σ1σ2
A more useful of writing this PDF is to use the column vector X = col (X1, X2) and thecovariance matrix
C =
σ21 σ1σ2ρ
σ1σ2ρ σ22
to write (using † to denote transpose)
fX(X) =1
2π(detC)1/2exp
−12X†C−1X
.
The bivariate Gaussian is used frequently in likelihood and Bayesian estimation to displaycontours for parameter estimates.
1
Figure 1: Scatter plots of two random variables X1,2 that have a joint Gaussian PDF for four different values of correlation coefficient, ρ.
2
Generating Correlated Random Variables
Consider a (pseudo) random number generator that gives numbers consistent with a 1D Gaus-sian PDF ≡ N(0, σ2) (zero mean with variance σ2).
How do we create two Gaussian random variables (GRVs) from N(0, σ2) but that are correlatedwith correlation coefficient ρ?
So we wantρX1,X2 =
〈(X1 − 〈X1〉) (X2 − 〈X2〉)〉σ2
.
Define Y1, Y2 as independent N(0, σ2) GRVs, so ρY1,Y2 = 0 and let
X1 = aY1 + bY2
X2 = cY1 + dY2.
Since the means of all variables are zero, we have
〈X1X2〉 = 〈(aY1 + bY2)(cY1 + dY2)〉= ac〈Y 2
1 〉 + bd〈Y 22 〉 + (ad + bc)〈Y1Y2〉
= (ac + bd)σ2
ThereforeρX1X2 =
〈X1X2〉σ2
= ac + bd (1)
3
We also want〈X2
1〉 = (a2 + b2)σ2 = σ2
〈X22〉 = (c2 + d2)σ2 = σ2
so
a2 + b2 = c2 + d2 = 1 (2)
A natural solution is to use a = cosφ b = sinφ
c = sinφ d = cosφ.
Then the constraint equations (1) and (2) are satisfied and