Message Boards Message Boards

1
|
6400 Views
|
9 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Strange PDF of BinomialDistribution

Posted 3 years ago
PDF[BinomialDistribution[1,.5],{0,0.5,1}]

gives {0.5,0.63662,0.5}

and

PDF[BernoulliDistribution[.5],{0,0.5,1}]

gives {0.5,0,0.5}.

Obviously, BinomialDistribution[1,.5] and BernoulliDistribution[.5] are the same.

POSTED BY: Stefan Huschens
9 Replies

Maybe this helps. Just made it for myself. We need to study the documentation more thanks.

POSTED BY: Raspi Rascal

strange input ( $n=1$ srsly ) $\Rightarrow$ strange output

r u testing robustness of mma function

POSTED BY: Raspi Rascal

n=1 is not the point:

In[2]:= p[t_] := PDF[BinomialDistribution[2, 0.5], t]; {p[0.5]} == p[{0.5}]
out[2] = False
POSTED BY: Stefan Huschens

Strange or not?

In[1]:= p[t_] := PDF[BinomialDistribution[1, 0.5], t]; {p[0.5]} == p[{0.5}]
Out[1]= false 
POSTED BY: Stefan Huschens

Yes, somewhat strange, indeed! If you define you probability p as a pure function, then it works:

p = PDF[BinomialDistribution[2, 0.5]];
{p[0.5]} == p[{0.5}]
(*  Out:  True  *)
POSTED BY: Henrik Schachner

i havent studied distributions yet but this look very mathematical:

In[174]:= PDF[BinomialDistribution[1, 5/10], {0, 5/10, 1}]

Out[174]= {1/2, 2/\[Pi], 1/2}
POSTED BY: Raspi Rascal
Posted 3 years ago

If you feed a list to PDF as the 2nd argument it ussumes that you want to calculate the multivariate PDF (ceck the documentation). I guess this is not what you intended. To compute the PDF for several x values you can use for instance Map

Map[PDF[BinomialDistribution[1, 0.5], #] &, {0, 0.5, 1}]
Map[PDF[BernoulliDistribution[0.5], #] &, {0.0, .5, 1}]

By doing so we get {0.5, 0, 0.5} as a result for each of these as expected

POSTED BY: Michael Helmle
Posted 3 years ago

Good reminder to RTFM (for all parts of the code). But what multivariate distribution would result in

{0.5,0.63662,0.5}

from

PDF[BinomialDistribution[1,.5],{0,0.5,1}]
POSTED BY: Jim Baldwin
Posted 3 years ago

The issue appears to be that

PDF[BinomialDistribution[n,p],{x}]

doesn't catch illegitimate values for x between 0 and n. And maybe "illegitimate" is a bit strong: it doesn't appropriately give a zero probability to values between 0 and n. It does give a zero probability for values larger than n and values less than 0. (Mathematica 12.2, Windows 10)

You should report this to Wolfram, Inc.

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