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
have probability mass function (pmf)
Here, parameter
is the probability of success, while parameter
is a positive integer. In Mathematica, we enter this as:
![[Graphics:Images/index_gr_6.gif]](Images/index_gr_6.gif)
This is known as the Pascal distribution. Here is a plot of
:
![[Graphics:Images/index_gr_8.gif]](Images/index_gr_8.gif)
Fig. 1: The pmf of a Pascal discrete random variable
Here is the cdf, equal to
:
![[Graphics:Images/index_gr_11.gif]](Images/index_gr_11.gif)
The mean
and variance of
are given by:
![[Graphics:Images/index_gr_15.gif]](Images/index_gr_15.gif)
![[Graphics:Images/index_gr_17.gif]](Images/index_gr_17.gif)
The probability generating function (pgf) is
:
![[Graphics:Images/index_gr_20.gif]](Images/index_gr_20.gif)