Simple addition to random module - Student's t

Robert Kern robert.kern at gmail.com
Wed Sep 2 22:34:26 CEST 2009


On 2009-09-02 14:15 PM, Raymond Hettinger wrote:
> On Sep 2, 6:51 am, Thomas Philips<tkp... at gmail.com>  wrote:
>> While the random module allows one to generate randome numbers with a
>> variety of distributions, some useful distributions are omitted - the
>> Student's t being among them.
>
> I'm curious to hear what your use cases are.
>
> My understanding is that t-distribution is an estimation tool
> used with small samples of a population where the variance or
> standard deviation is unknown.
>
> So, when do you ever need to generate random variables with
> this distribution?  ISTM that this is akin to wanting
> a generator for a Kolmogorov distribution -- usually the
> distribution is used to test empirical data, not to generate it.

In more complicated models, estimates of one parameter need to be propagated 
through the model, particularly if you are looking at sensitivity to parameters. 
Student's t describes the variation of an estimate of a mean of a sample from a 
Gaussian distribution. If I were modeling a processing wherein someone makes an 
estimate of a mean and then acts on that estimate, I would want to generate 
random t variates to feed that model.

> I think most of the existing generators were chosen because they
> are useful in simulation programs.  AFAICT, the Student's t-
> distribution
> doesn't fall into that category (usually, you know the population
> standard deviation when you're the one generating data).

Student's t distribution is also used as a sort of generic fat-tailed 
distribution in some models and is not tied to the "estimate of a mean" description.

> ISTM, there ought to be a statistics module that can calculate
> cumulative distribution functions for a variety of distributions.
> This would be far more helpful than creating more generators.

Yes, scipy.stats.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list