Discrete Random Variables

mathStatica automatically handles discrete random variables in the standard way. The only difference is that, when we define the density, we add a flag to tell Mathematica that the random variable is {Discrete}. To illustrate, let the discrete random variable [Graphics:Images/index_gr_1.gif] have probability mass function (pmf)

[Graphics:Images/index_gr_2.gif],       for [Graphics:Images/index_gr_3.gif].

Here, parameter [Graphics:Images/index_gr_4.gif] is the probability of success, while parameter [Graphics:Images/index_gr_5.gif] is a positive integer. In Mathematica, we enter this as:

[Graphics:Images/index_gr_6.gif]

This is known as the Pascal distribution. Here is a plot of [Graphics:Images/index_gr_7.gif]:

[Graphics:Images/index_gr_8.gif]

[Graphics:Images/index_gr_9.gif]

Fig. 1: The pmf of a Pascal discrete random variable

Here is the cdf, equal to [Graphics:Images/index_gr_10.gif]:

[Graphics:Images/index_gr_11.gif]
[Graphics:Images/index_gr_12.gif]

The mean [Graphics:Images/index_gr_13.gif] and variance of [Graphics:Images/index_gr_14.gif] are given by:

[Graphics:Images/index_gr_15.gif]
[Graphics:Images/index_gr_16.gif]
[Graphics:Images/index_gr_17.gif]
[Graphics:Images/index_gr_18.gif]

The probability generating function (pgf) is [Graphics:Images/index_gr_19.gif]:

[Graphics:Images/index_gr_20.gif]
[Graphics:Images/index_gr_21.gif]