Question: CDF of Binomial(2, 1/2) is wrong

with(Statistics):

CDF(Binomial(2, 1/2), x); # wrong
               piecewise(x < 0, 0, 2 <= x, 1, 1)

CDF(Binomial(2, p), x); # also wrong
     piecewise(x < 0, 0, 2 <= x, 1, p = 0, 1, p = 1, 0, 1)

Maple can actually generate PDFs for discrete distributions:

bpdf := unapply(PDF(Binomial(2, 1/2), x), x);
          x -> (1/4)*Dirac(x)+(1/2)*Dirac(x-1)+(1/4)*Dirac(x-2)

int(bpdf(t), t = -infinity .. x); # correct CDF
         (1/4)*Heaviside(x)+(1/2)*Heaviside(x-1)+(1/4)*Heaviside(x-2)

But then functions of random variables do not seem to work :

bdist := Distribution(PDF = bpdf, Support = -infinity .. infinity);

CDF(bdist, x); # OK
           piecewise(x < 0, 0, x = 0, undefined, x < 1, 1/4, x = 1, undefined, x < 2, 3/4, x = 2,
           undefined, 2 < x, 1)

CDF(add(RandomVariable(bdist), i = 1 .. 2), x); # indeterminate
          int((1/16)*Dirac(_t)^2+(1/4)*Dirac(0)*Dirac(_t-1)+(3/8)*Dirac(0)*Dirac(_t-2)+(1/4)*Dirac(0)*
          Dirac(_t-3)+(1/16)*Dirac(0)*Dirac(_t-4), _t = -infinity .. x)

It's a bit disappointing that Maple generates PDFs in terms of the delta function but doesn't support them properly, because that could be an easy and natural way to define mixed distributions.

Please Wait...