Basics: Working with arbitrary distributions

mathStatica adds about 100 new functions to Mathematica. But most of the time, we can get by with just four of them:


Table 1:  Core functions for a random variable [Graphics:Images/index_gr_2.gif] with density [Graphics:Images/index_gr_3.gif]

This ability to handle plotting, expectations, probability, and transformations, with just four functions, makes the mathStatica system very easy to use, even for those not familiar with Mathematica.

To illustrate, let us suppose the continuous random variable [Graphics:Images/index_gr_4.gif] has probability density function (pdf)

[Graphics:Images/index_gr_5.gif],    for [Graphics:Images/index_gr_6.gif].

We enter this as:


This is known as the Arc--Sine distribution. Here is a plot of [Graphics:Images/index_gr_8.gif]:



Fig. 1: The Arc-Sine pdf

Here is the cumulative distribution function (cdf), [Graphics:Images/index_gr_11.gif], which also provides the clue to the naming of this distribution:


The mean, [Graphics:Images/index_gr_14.gif], is:


while the variance of [Graphics:Images/index_gr_17.gif] is:


The [Graphics:Images/index_gr_20.gif] moment of [Graphics:Images/index_gr_21.gif] is [Graphics:Images/index_gr_22.gif]:


Now consider the transformation to a new random variable [Graphics:Images/index_gr_26.gif] such that [Graphics:Images/index_gr_27.gif]. By using the Transform and TransformExtremum functions, the pdf of [Graphics:Images/index_gr_28.gif], say [Graphics:Images/index_gr_29.gif], and the domain of its support can be found:


So, we have started out with a quite arbitrary pdf [Graphics:Images/index_gr_34.gif], transformed it to a new one [Graphics:Images/index_gr_35.gif], and since both density g and its domain have been entered into Mathematica, we can also apply the mathStatica tool set to density [Graphics:Images/index_gr_36.gif]. For example, use PlotDensity[g] to plot the pdf of [Graphics:Images/index_gr_37.gif].