A question about the distribution of random numbers

#1
Suppose I have two independent random variables A, and B, which are distributed Normally as follows:

A: N~(MA,VA)
B: N~(MB,VB)

Now consider that I draw many A's and B's and arrange these randomly and pair-wise (A's next to B's).

Having done that, I then identify all those values of A drawn, which are greater than their partnering value of B. Let us call these identified values C.

My question is now this: How is C distributed?
 

Dason

Ambassador to the humans
#2
So it sounds like we could rephrase this as: For A and B as defined previously what is the distribution of (A | A > B)

Is this correct?
 

hlsmith

Not a robit
#4
Lets hope that someone else chimes in, because I am slightly out of my element here, but my inclination would be:

Bin(0.5,n)
 

BGM

TS Contributor
#5
I guess it maybe called a "random-truncated normal distribution".

The cumulative distribution function can be calculated by definition as usual:

\( \Pr\{A \leq a|A > B\}
= \frac {\Pr\{A \leq a, A > B\}} {\Pr\{A > B\}} \)

Since \( A \sim \mathcal{N}(\mu_A, \sigma^2_A), B \sim \mathcal{N}(\mu_B, \sigma^2_B) \) and they are independent,
we have \( A - B \sim \mathcal{N}(\mu_A - \mu_B, \sigma^2_A + \sigma^2_B) \)

and thus the denominator
\( \Pr\{A > B\} = \Pr\{A - B > 0\}
= \Phi\left(\frac {\mu_A - \mu_B} {\sqrt{\sigma^2_A + \sigma^2_B}}\right) \)

For the numerator,
\( \Pr\{A \leq a, A > B\} = \int_{-\infty}^a \Pr\{B < x\}f_A(x)dx \)
which at least can be computed numerically.

If you seek the probability density function, by differentiation,

\( f_C(a) =
\Phi\left(\frac {\mu_A - \mu_B} {\sqrt{\sigma^2_A + \sigma^2_B}}\right)^{-1}
\Phi\left(\frac {a - \mu_B} {\sigma_B}\right)\frac {1} {\sigma_A}\phi\left(\frac {a - \mu_A} {\sigma_A}\right) \)
 
#6
Thank you BGM for taking the time. I have a few questions about your solution:

1) What is a? Dason noted that my problem was to find the distribution of (A | A > B) which doesn't include a.

2) What is phi?

3) What is capital phi?

(Is this a new distribution?!) :)

Cheers
 

Dason

Ambassador to the humans
#7
Thank you BGM for taking the time. I have a few questions about your solution:

1) What is a? Dason noted that my problem was to find the distribution of (A | A > B) which doesn't include a.

2) What is phi?

3) What is capital phi?

(Is this a new distribution?!) :)

Cheers
a is the value of A under consideration. Since he was specifying a density "a" is the input value for the pdf.

phi is the density of the standard normal distribution. Capital phi is the CDF of the standard normal distribution. Is the result a new distribution? It doesn't have a name (that I know of) but I'm sure somebody else has thought of it before.
 
#8
Okay, that makes more sense. However, then my question is, do phi and PHI have particular means and variances?

(Oh, perhaps I already know the answer... Mean = muA - muB, and VAR = sig^2A + sig^2B ?)
 
#11
I am not so sure about BGM's solution. I have tried to examine the result using Mathematica, but I am probably doing something wrong. My Mathematica code is shown below:

\[Mu]1 = 11
\[Mu]2 = 10
\[Mu] = \[Mu]1 - \[Mu]2
\[Sigma]1 = 1
\[Sigma]2 = 5
\[Sigma] = \[Sigma]1 + \[Sigma]2
\[CapitalEta] = (\[Mu] /(Sqrt[\[Sigma]1^2 + \[Sigma]2^2]))^-1
\[CapitalRho] = ((x - \[Mu]2)/\[Sigma]2)*(1/\[Sigma]1)
\[CapitalNu] = ((x - \[Mu]1)/\[Sigma]1 )

Plot[CDF[NormalDistribution[\[Mu], \[Sigma]], x]*\[CapitalEta]*
CDF[NormalDistribution[\[Mu], \[Sigma]], x]*\[CapitalRho]*
PDF[NormalDistribution[\[Mu], \[Sigma]], x]*\[CapitalNu], {x, -100,
100}]


Any ideas where I am making a mistake?
 

Dason

Ambassador to the humans
#14
that exponential to the minus one does not mean division. it's asking you to take the inverse function of the standard normal CDF.
No it actually does mean division in this case. But the fact is that you don't get 0. You get \(\Phi(0)^{-1} = .5^{-1} = 2\)
 

Dragan

Super Moderator
#15
I am not so sure about BGM's solution. I have tried to examine the result using Mathematica, but I am probably doing something wrong. My Mathematica code is shown below:

\[Mu]1 = 11
\[Mu]2 = 10
\[Mu] = \[Mu]1 - \[Mu]2
\[Sigma]1 = 1
\[Sigma]2 = 5
\[Sigma] = \[Sigma]1 + \[Sigma]2
\[CapitalEta] = (\[Mu] /(Sqrt[\[Sigma]1^2 + \[Sigma]2^2]))^-1
\[CapitalRho] = ((x - \[Mu]2)/\[Sigma]2)*(1/\[Sigma]1)
\[CapitalNu] = ((x - \[Mu]1)/\[Sigma]1 )

Plot[CDF[NormalDistribution[\[Mu], \[Sigma]], x]*\[CapitalEta]*
CDF[NormalDistribution[\[Mu], \[Sigma]], x]*\[CapitalRho]*
PDF[NormalDistribution[\[Mu], \[Sigma]], x]*\[CapitalNu], {x, -100,
100}]


Any ideas where I am making a mistake?

I believe your original question can be thought of equivalently as the maximum of A,B.

Therefore take the product of the two CDFs (in one variable, say, X) and then take the derivative of the resulting product with respect to X and that should be your PDF.
 

spunky

Doesn't actually exist
#16
No it actually does mean division in this case. But the fact is that you don't get 0. You get \(\Phi(0)^{-1} = .5^{-1} = 2\)
fail on my part for not reading the order of operations properly. CDF FIRST, then INVERSE.

darn it, but thanks for the correction!
 
#17
I believe your original question can be thought of equivalently as the maximum of A,B.

Therefore take the product of the two CDFs (in one variable, say, X) and then take the derivative of the resulting product with respect to X and that should be your PDF.
My skill at statistics could be much better, and I am working on it, but right now, I don't know how to arrive at the PDF. I bought a licence for Mathematica, and I am working on learning that skill. If anyone on here would be kind enough to write the Mathematica code for the solution give by either Dragan above or BGM (or both), I would be extremely appreciative. That way, I know I haven't made an error, and I will be able to study the code and learn exactly what is going on.

And thank you for all the help so far!
 

Dragan

Super Moderator
#18
My skill at statistics could be much better, and I am working on it, but right now, I don't know how to arrive at the PDF. I bought a licence for Mathematica, and I am working on learning that skill. If anyone on here would be kind enough to write the Mathematica code for the solution give by either Dragan above or BGM (or both), I would be extremely appreciative. That way, I know I haven't made an error, and I will be able to study the code and learn exactly what is going on.

And thank you for all the help so far!

This is what I mean in Mathematica. A hypothetical with MuA=10, Sigma=3; and MuB=9, Sigma=2

phiA=CDF[NormalDistribution[10,3], X]
phiB=CDF[NormalDistribution[9,2], X]
u=phiA*PhiB
v=D[u,X]

v is the derivative of u (the product of the two CDFs) and should be you probability density function.
 
#19
Thank you Dragan. I have implemented the code in Mathematica and plotted the PDF:

phiA = CDF[NormalDistribution[10, 1], X]
phiB = CDF[NormalDistribution[10, 5], X]
u = phiA*phiB
v = D[u, X]

Plot[(E^((12*(-10 + X)^2)/25)*Erfc[-((-10 + X)/Sqrt[2])] +
5*Erfc[-((-10 + X)/(5*Sqrt[2]))])/(10*E^((-10 + X)^2/2)*
Sqrt[2*Pi]), {X, 4.6, 15}]

The result is the "Dragan" plot attached.

Comparing that to the distribution derived from simulation, I think there is something wrong with the proposed solution. This distribution is also attached, and called "Simulation".

Is BGM correct? What would his Mathematica code look like? I realize this is asking a lot...
 
#20
\( f_C(a) =
\Phi\left(\frac {\mu_A - \mu_B} {\sqrt{\sigma^2_A + \sigma^2_B}}\right)^{-1}
\Phi\left(\frac {a - \mu_B} {\sigma_B}\right)\frac {1} {\sigma_A}\phi\left(\frac {a - \mu_A} {\sigma_A}\right) \)
I would very much appreciate it if someone would post the Mathematica code for this...