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∼N(μ1,σ21) and Y∼N(μ2,σ22), with parameter conditions:
Problem: Find the pdf of X+Y2|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∼N(μ1−μ2,σ21+σ22) with cdf Φ(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=X+Y2
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=X+Y2 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: μ1=−1,μ2=4,σ1=1,σ2=12
Looks fine.
Comments
Post a Comment