Simple addition to random module - Student's t

Terry Reedy tjreedy at udel.edu
Thu Sep 3 09:34:38 CEST 2009


Robert Kern wrote:
> 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.

Yes. One can run the simulation with various df's to see the effect of 
such data and possibly how and when a model breaks.

>> 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.

Is that stable enough so that all or part could be added to stdlib?

tjr





More information about the Python-list mailing list