Is the following attempt beyond Mathematica 11?
Z = TransformedDistribution[ (A + B)/2 \[Conditioned] A < B, {A \[Distributed] NormalDistribution[mA , sA], B \[Distributed] NormalDistribution[mB , sB]}]
When I try to get Mathematica to show me the PDF of Z, it doesn't work. I tried:
PDF[Z, y]
Answer
It is possible to derive an exact solution to this problem.
Given: $X$ and $Y$ are independent random variables where $X \sim N(\mu_1, \sigma_1^2)$ and $Y \sim N(\mu_2, \sigma_2^2)$, with parameter conditions:
Problem: Find the pdf of $\frac{X+Y}{2} \; \big| \; X < Y$
- Joint pdf of $(X,Y)$:
By independence, the joint pdf of $(X,Y)$, say $f(x,y)$ is simply the product of the individual pdf's:
- Let $V = X - Y$. Then $V \sim N(\mu_1 - \mu_2, \sigma_1^2 + \sigma_2^2)$ with cdf $\Phi(v)$.
Let constant $c = P(X
- Conditional joint pdf:
The conditional pdf $f\big((x,y) \; \big| \; Xfcon
:
where all the dependence is captured within the fcon
statement using the Boole
statement, and we can enter the 'domain' as a rectangular structure on the real line, i.e.
domain[fcon] = domain[f]
- Transformation $Z = \frac{X+Y}{2}$
Given the conditional joint pdf $f\big((x,y) \; \big| \; X
where I am using the Transform
function from the mathStatica package for Mathematica, and the domain can again be entered as a rectangular set as:
Then, the marginal pdf of $Z = \frac{X+Y}{2}$ is:
... which is the exact solution. All done.
The following plot compares:
the exact symbolic pdf derived above (red dashed curve)
... to the Monte Carlo simulated pdf (squiggly blue curve)
... here when: $\mu_1 = -1, \mu_2 = 4, \sigma_1 = 1, \sigma_2 = 12$
Looks fine.
Comments
Post a Comment