Bivariate Normal Distribution

Author

Eric W. Weisstein
January 11, 2011

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Statistics/BivariateNormalDistribution.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/BivariateNormalDistribution.html.

©2010 Wolfram Research, Inc. except for portions noted otherwise

PDF

Simplify[PDF[MultinormalDistribution[{(Subscript[μ, 1]),(Subscript[μ, 2])},{{(Subscript[σ, 11]),(Subscript[σ, 12])},{(Subscript[σ, 12]),(Subscript[σ, 22])}}],{(Subscript[x, 1]),(Subscript[x, 2])}]]//TraditionalForm

Simplify[PDF[MultinormalDistribution[{(Subscript[μ, 1]),(Subscript[μ, 2])},{{(Subscript[σ, 1])^2,ρ (Subscript[σ, 1])(Subscript[σ, 2])},{ρ (Subscript[σ, 1])(Subscript[σ, 2]),(Subscript[σ, 2])^2}}],{(Subscript[x, 1]),(Subscript[x, 2])}],ρ>1&&(Subscript[σ, 1])>0&&(Subscript[σ, 2])>0]

FullSimplify[PDF[MultinormalDistribution[{(Subscript[μ, 1]),(Subscript[μ, 2])},{{(Subscript[σ, 1])^2,ρ (Subscript[σ, 1])(Subscript[σ, 2])},{ρ (Subscript[σ, 1])(Subscript[σ, 2]),(Subscript[σ, 2])^2}}],{(Subscript[x, 1]),(Subscript[x, 2])}],ρ>1&&(Subscript[σ, 1])>0&&(Subscript[σ, 2])>0]//Timing

(Subscript[P, c])[x_,y_]:=1/((Subscript[σ, 1 ])(Subscript[σ, 2])Sqrt[1-ρ^2]2π)Exp[-1/(2(1-ρ^2))(x^2/(Subscript[σ, 1]^2)-2 ρ x y/((Subscript[σ, 1]) (Subscript[σ, 2]))+y^2/(Subscript[σ, 2]^2))]

Expand[1/2/(1-ρ^2)(x^2/(Subscript[σ, 1]^2)-2 ρ x y/((Subscript[σ, 1]) (Subscript[σ, 2]))+y^2/ (Subscript[σ, 2]^2))]

(Subscript[P, c])[x,y]

Integrate[(Subscript[P, c])[x,y],{y,-∞,∞},Assumptions->{0<ρ<1,(Subscript[σ, 2])>0}]

FullSimplify[((((E^(-((x^2)/(2 (Subscript[σ, 1]^2))))) (Subscript[σ, 2]))/(Sqrt[(1/(2 π-2 π (ρ^2)))]))/( 2 π(Sqrt[1-(ρ^2)]) (Subscript[σ, 1]) (Subscript[σ, 2]))),{0<ρ<1,(Subscript[σ, 2])>0}]

P[x_,y_]:=1/((Subscript[σ, 1 ])(Subscript[σ, 2])Sqrt[1-ρ^2]2π)Exp[-1/(2(1-ρ^2))((x-(Subscript[μ, x]))^2/(Subscript[σ, 1]^2)-2 ρ (x-(Subscript[μ, x]))(y-(Subscript[μ, y]))/((Subscript[σ, 1]) (Subscript[σ, 2]))+(y-(Subscript[μ, y]))^2/(Subscript[σ, 2]^2))]

Integrate[P[x,y],{y,-∞,∞}]

Standard Bivariate PDF

p=PDF[MultinormalDistribution[{0,0},{{1,ρ},{ρ,1}}],{(Subscript[x, 1]),(Subscript[x, 2])}]

Normalization

v5.1

Block[{ρ=0},
CDF[MultinormalDistribution[{0,0},{{1,ρ},{ρ,1}}],{0,0}]
]

Integrate[p,{(Subscript[x, 1]),-∞,∞},{(Subscript[x, 2]),-∞,∞}]//Timing

v5.2

Block[{ρ=0},
CDF[MultinormalDistribution[{0,0},{{1,ρ},{ρ,1}}],{0,0}]
]

Integrate[p,{(Subscript[x, 1]),-∞,∞},{(Subscript[x, 2]),-∞,∞}]//Timing

v6

Block[{ρ=0},
CDF[MultinormalDistribution[{0,0},{{1,ρ},{ρ,1}}],{0,0}]
]

Integrate[p,{(Subscript[x, 1]),-∞,∞},{(Subscript[x, 2]),-∞,∞}]//Timing

V8

Expectation[1,{x,y}\[Distributed]MultinormalDistribution[{0,0},{{1,ρ},{ρ,1}}]]

With[{ρ=0},Probability[x>0&&y>0,{x,y}\[Distributed]MultinormalDistribution[{0,0},{{1,ρ},{ρ,1}}]]]

FullSimplify[Probability[x>0&&y>0,{x,y}\[Distributed]MultinormalDistribution[{0,0},{{1,ρ},{ρ,1}}]],-1<ρ<1]

PDF in each quadrant

v4.2

Integrate[p,{(Subscript[x, 1]),Sequence@@First[#]},{(Subscript[x, 2]),Sequence@@Last[#]},Assumptions->-1≤ρ≤1]&/@{
{{0,∞},{0,∞}},
{{-∞,0},{0,∞}},
{{-∞,0},{-∞,0}},
{{0,∞},{-∞,0}}
}

Apart/@FullSimplify[%,-1≤ρ≤1]

FullSimplify[Plus@@%]

Integrate[p,{(Subscript[x, 1]),Sequence@@First[#]},{(Subscript[x, 2]),Sequence@@Last[#]}]&/@{
{{0,∞},{0,∞}},
{{-∞,0},{0,∞}},
{{-∞,0},{-∞,0}},
{{0,∞},{-∞,0}}
}

Apart/@FullSimplify[%,-1≤ρ≤1]

FullSimplify[Plus@@%]

v5.0

Integrate[p,{(Subscript[x, 1]),Sequence@@First[#]},{(Subscript[x, 2]),Sequence@@Last[#]},Assumptions->-1≤ρ≤1]&/@{
{{0,∞},{0,∞}},
{{-∞,0},{0,∞}},
{{-∞,0},{-∞,0}},
{{0,∞},{-∞,0}}
}

Apart/@FullSimplify[%,Assumptions->-1≤ρ≤1]

Integrate[p,{(Subscript[x, 1]),Sequence@@First[#]},{(Subscript[x, 2]),Sequence@@Last[#]}]&/@{
{{0,∞},{0,∞}},
{{-∞,0},{0,∞}},
{{-∞,0},{-∞,0}},
{{0,∞},{-∞,0}}
}

Apart/@FullSimplify[%,Assumptions->-1≤ρ≤1]

FullSimplify[Plus@@%]

v5.1

Integrate[p,{(Subscript[x, 1]),Sequence@@First[#]},{(Subscript[x, 2]),Sequence@@Last[#]},Assumptions->-1≤ρ≤1]&/@{
{{0,∞},{0,∞}},
{{-∞,0},{0,∞}},
{{-∞,0},{-∞,0}},
{{0,∞},{-∞,0}}
}

Apart/@FullSimplify[%,Assumptions->-1≤ρ≤1]

Integrate[p,{(Subscript[x, 1]),Sequence@@First[#]},{(Subscript[x, 2]),Sequence@@Last[#]}]&/@{
{{0,∞},{0,∞}},
{{-∞,0},{0,∞}},
{{-∞,0},{-∞,0}},
{{0,∞},{-∞,0}}
}

Apart/@FullSimplify[%,Assumptions->-1≤ρ≤1]

FullSimplify[Plus@@%]

v5.2

Integrate[p,{(Subscript[x, 1]),Sequence@@First[#]},{(Subscript[x, 2]),Sequence@@Last[#]},Assumptions->-1≤ρ≤1]&/@{
{{0,∞},{0,∞}},
{{-∞,0},{0,∞}},
{{-∞,0},{-∞,0}},
{{0,∞},{-∞,0}}
}

v6

Integrate[p,{(Subscript[x, 1]),Sequence@@First[#]},{(Subscript[x, 2]),Sequence@@Last[#]},Assumptions->-1≤ρ≤1]&/@{
{{0,∞},{0,∞}},
{{-∞,0},{0,∞}},
{{-∞,0},{-∞,0}},
{{0,∞},{-∞,0}}
}

FullSimplify[%3,-1<ρ<1]

FullSimplify[%3,-1<ρ<1&&ρ≠0]

Integrate[p,{(Subscript[x, 1]),Sequence@@First[#]},{(Subscript[x, 2]),Sequence@@Last[#]},Assumptions->-1<ρ<1]&/@{
{{0,∞},{0,∞}},
{{-∞,0},{0,∞}},
{{-∞,0},{-∞,0}},
{{0,∞},{-∞,0}}
}

FullSimplify[%,-1<ρ<1&&ρ≠0]

%6 /. ρ->0

FullSimplify[%4,ρ==0]

Analytic

v5.0

CDF[MultinormalDistribution[{0,0},{{1,ρ},{ρ,1}}],{0,0}]

v5.1

CDF[MultinormalDistribution[{0,0},{{1,ρ},{ρ,1}}],x]

V8

FullSimplify[Probability[x>0&&y>0,{x,y}\[Distributed]MultinormalDistribution[{0,0},{{1,ρ},{ρ,1}}]],-1<ρ<1]

FullSimplify[Subtract@@{((π+2 ArcTan[((Abs[ρ])/(Sqrt[1-(ρ^2)]))])/(4 π)),(1/4)+((ArcSin[ρ])/(2π))},-1<ρ<1]

FullSimplify[((π+2 ArcTan[((Abs[ρ])/(Sqrt[1-(ρ^2)]))])/(4 π)),#]&/@{-1<ρ<0,0<ρ<1}

FullSimplify[Probability[x>0&&y<0,{x,y}\[Distributed]MultinormalDistribution[{0,0},{{1,ρ},{ρ,1}}]],-1<ρ<1]

FullSimplify[((ArcCot[((Abs[ρ])/(Sqrt[1-(ρ^2)]))])/(2 π))-((ArcCos[ρ])/(2π)),-1<ρ<1]

FullSimplify[((ArcCot[((Abs[ρ])/(Sqrt[1-(ρ^2)]))])/(2 π)),#]&/@{-1<ρ<0,0<ρ<1}

Plot

Plot[
CDF[MultinormalDistribution[{0,0},{{1,ρ},{ρ,1}}],{0,0}],
{ρ,-.92,.92}]

Plot[
CDF[MultinormalDistribution[{0,0},{{1,ρ},{ρ,1}}],{0,0}],
{ρ,-.99,.99}]

With[{ρ=.9},CDF[MultinormalDistribution[{0,0},{{1,ρ},{ρ,1}}],{0,0}]]//Timing

CDF[MultinormalDistribution[{0,0},{{1,ρ},{ρ,1}}],{x1,x2}]

<<mathStatica`;

With[{ρ=.9},MrSpeedy[CDF[MultinormalDistribution[{0,0},{{1,ρ},{ρ,1}}],{#1,#2}]&,{{-∞,0},{-∞,0}}]
]//Timing

With[{ρ=.9999},CDF[MultinormalDistribution[{0,0},{{1,ρ},{ρ,1}}],{0,0}]]

MultinormalDistribution[{0,0},{{1,ρ},{ρ,1}},{x1,x2}]