MarginalDistribution with Symbolic range in ProbabilityDistribution
Comparing with mathStatica output ...
f = ((20 - x)/(25*x));
domain[f] = {{x, 10, 20}, {y, x/2, x}};
Then:
works fine, so there does seem to be something odd with the Wolfram algorithm here.
Having said so, the best technique to use when dealing with functions that have dependency in the domain of support (as your example has) is to place all the dependency into the joint pdf itself (the density part) using Boole
or Piecewise
, so that the domain {{x, 10, 20}, {y, a, b}}
part is a rectangular set. For your example, we could enter say:
g = ((20-x)/(25x)) * Boole[x/2 < y < x];
domain[g] = {{x, 10, 20}, {y, 0, 20}};
The range of values on y
just has to be large enough to cover the full domain of support ... if you don't want to think, simply enter y
on the real line {y, -Infinity, Infinity}
to cover all cases.
Then:
where I am again using the Marginal
function in the mathStatica package for Mathematica. The Wolfram version works fine with this setup:
PDF[MarginalDistribution[ProbabilityDistribution[g, {x, 10, 20}, {y, 0, 20}], 1], x]
Setting things up this way is a good habit to get into, because it makes it easy to use other Mathematica functions such as Plot3D
to plot the joint pdf:
Plot3D[g, {x, 10, 20}, {y, 0, 20}]
Boole
allows evaluation:
f[x_, y_] := (20 - x)/(25 x) Boole[x/2 < y < x]
pd = ProbabilityDistribution[
f[x, y], {x, 10, 20}, {y, -Infinity, Infinity}]
PDF[MarginalDistribution[pd, 1], x]