Group Abstract Group Abstract

Message Boards Message Boards

0
|
7.1K Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Is there a bug in the TransformedDistribution function?

Posted 11 years ago

In a simple example I tried to use TransformedDistribution to define a probability distribution of a variable that is +/- 1 with probability 1/2. Doing so results in an extraneous value in the resulting PDF.

z = TransformedDistribution[2 x - 1, x \[Distributed] BinomialDistribution[1, 1/2]]
PDF[z][Range[-2, 2]]
{0, 1/2, 2/\[Pi], 1/2, 0}

There does not seem to be a problem in defining the Binomial distribution for a single trial.

w = TransformedDistribution[x, x \[Distributed] BinomialDistribution[1, 1/2]];    
PDF[w][Range [-1, 2]]    
{0, 1/2, 1/2, 0}

I am running Mathematica Home Edition version 10.0.2

POSTED BY: Mike Luntz
3 Replies
Posted 11 years ago
POSTED BY: Jim Baldwin
Posted 11 years ago

Just an update:

When I explicitly use a Bernoulli distribution instead of a single sample of the Binomial distribution the transformation yields the correct result.

 w = TransformedDistribution[2 x - 1, x \[Distributed] BernoulliDistribution[1/2]]
 PDF[w][Range[-2, 2]]
 {0, 1/2, 0, 1/2, 0}
POSTED BY: Mike Luntz

Mike,

It seems to be a problem of how the PDF function is mapping itself onto a list, rather than a problem with TransformedDistribution. I get the correct answer with:

PDF[z, #] & /@ Range[-2, 2]
{0, 1/2, 0, 1/2, 0}

Which shows that the PDF function itself is fine. I get the wrong answer even if I do:

 PDF[z, {-1, 0}]
{1/2, 2/\[Pi]}

Cannot say that I understand why. The function description states that it is Listable.

Best,

OL.

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