Message Boards Message Boards

0
|
5613 Views
|
8 Replies
|
1 Total Likes
View groups...
Share
Share this post:

PDF of a Transformed discrete distribution

Posted 4 years ago

Hi all, This code returns results not matching the results of the book I am working on.

f[x_] := Piecewise[{{1/3, x == {1, 1}}, {2/3, x == {2, 0}}}];
\[ScriptCapitalD] := 
  ProbabilityDistribution[
   f[{x1, x2}], {x1, -Infinity, Infinity}, {x2, -Infinity, Infinity}]; 
PDF[TransformedDistribution[
   2 {x1, x2}, {x1, x2} \[Distributed] \[ScriptCapitalD]], {y1, 
   y2}] // FullSimplify

i should have a result like P(Y==y)=P(g^-1(y)) for g an increasing function which is not the result Mathematica proposes. Any suggestions? Thx.

8 Replies
Posted 4 years ago

No. Read the online reference of Discrete Multivariate Distributions under Scope. You still need dx.

POSTED BY: Jim Baldwin
Posted 4 years ago

Your example I think just isn't the kind of probability distribution that ProbabilityDistribution and TransformedDistribution can handle. However, those two functions do handle Exercise 3 of the reference you posted:

dist = ProbabilityDistribution[x^2/30, {x, 1, 4, 1}]
PDF[dist, x]

Discrete distribution

Now the transformation part of the exercise:

dist2 = TransformedDistribution[x + 1, x \[Distributed] dist]
PDF[dist2, y]

Transformed distribution

POSTED BY: Jim Baldwin

I see, the dx here is the increment of x to move from xmin to xmax However, I am using the 1st definition in the case of multivariate. no need for dx. enter image description here Thank u for everything.

Posted 4 years ago

From the online reference:

ProbabilityDistribution for discrete distributions

POSTED BY: Jim Baldwin
Posted 4 years ago

The dx term is found in the online reference for ProbabilityDistribution.

POSTED BY: Jim Baldwin

Thx for the feedback, I was really doubting myself. As per your comment "For discrete distributions there is a dx value that is needed", please share references since the book provided a satisfactory demonstration. Maybe you are referring to a continuous function f which is not the case in this problem.

Posted 4 years ago

You're writing a book or going through an existing book?

Everything you wrote looks good except for one thing. For discrete distributions there is a dx value that is needed. However, that doesn't seem fix things.

The following seems to get a bit farther:

f[{x1_, x2_}] := Piecewise[{{1/3, {x1, x2} == {1, 1}}, {2/3, {x1, x2} == {2, 0}}}];
\[ScriptCapitalD] = ProbabilityDistribution[f[{x1, x2}], {x1, -10, 10, 1}, {x2, -10, 10, 1}];
Mean[\[ScriptCapitalD]]

$$\left\{\frac{5}{3},\frac{1}{3}\right\}$$

Variance[\[ScriptCapitalD]]

$$\left\{2/9, 2/9\right\}$$

Covariance[\[ScriptCapitalD]]

$$\left\{\left\{2/9, -(2/9)\right\}, \left\{-(2/9), 2/9\right\}\right\}$$

\[ScriptCapitalD]2 = TransformedDistribution[2 {x1, x2}, {x1, x2} \[Distributed] \[ScriptCapitalD]] // 
   FullSimplify;
Mean[\[ScriptCapitalD]2]

$$\left\{\frac{10}{3},\frac{2}{3}\right\}$$

Variance[\[ScriptCapitalD]2]

$$\left\{\frac{8}{9},\frac{8}{9}\right\}$$

Covariance[\[ScriptCapitalD]2]

$$\left\{\left\{8/9, -(8/9)\right\}, \left\{-(8/9), 8/9\right\}\right\}$$

But RandomVariate doesn't work with the above. For your particular example things can be rewritten so that RandomVariate works

d = TransformedDistribution[2 {x + 1, 1 - x}, x \[Distributed] BernoulliDistribution[2/3]];
RandomVariate[d, 10]
(* {{4, 0}, {2, 2}, {4, 0}, {4, 0}, {4, 0}, {4, 0}, {4, 0}, {2, 2}, {4, 0}, {4, 0}} *)

I suspect that ProbabilityDistribution and/or TransformedDistribution just can't handle the structure you have. (I'd like to be wrong about that.)

POSTED BY: Jim Baldwin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract