[SciPy-User] deterministic random variable

josef.pktd at gmail.com josef.pktd at gmail.com
Thu May 13 00:35:07 EDT 2010


On Mon, May 3, 2010 at 3:32 PM, nicky van foreest <vanforeest at gmail.com> wrote:
> Hi Josef,
>
> Thanks for your answer.
>
> On 3 May 2010 15:16,  <josef.pktd at gmail.com> wrote:
>> On Mon, May 3, 2010 at 6:04 AM, nicky van foreest <vanforeest at gmail.com> wrote:
>>> Hi,
>>>
>>> As far as I can see scipy.stats does not support the deterministic
>>> distribution. Would it be a good idea to implement this also? In my
>>> opinion this distribution is very useful to use as a test case, for
>>> debugging purposes for instance.
>
> One case is the M/D/1 queue, a single server with exponentially
> distributed interarrival times and deterministic service times.
> Another case is an inventory system with periodic replenishments, and
> random demands. A first simple model would be to use deterministically
> distributed interreplenishment times. The size of demand can also be
> taken to be deterministic, as an interesting limiting case.
>
>>
>> You mean something like http://en.wikipedia.org/wiki/Degenerate_distribution
>> (I never heard the term deterministic distribution before).
>
> Yes.
>
>
>>
>> If the support is an integer, then rv_discrete might work, looks good see below
>>
>> Are there any useful operations, that we could do with it?
>
> Yes, like simulating the M/D/1 queue. Suppose I would like to build a
> queueing simulator. I would like to set this up in a generic way, and
> pass rv_arrival and  rv_service as frozen rvs, Like this I can
> experiment with several distributions, including the deterministic
> distribution as a limiting case or simple case,  all within the same
> framework.
>
>> I think I can see a case for debugging programs that use the
>> distributions in scipy.stats, but almost degenerate might also work
>> for debugging.
>
> Sure, but sometimes you just want to exclude random effects. Moreover,
> I would like to see "rv = stats.deterministic(...)" in the  code, for
> the purpose of readability.
>
>>
>> What I would like to have is a discrete distribution on the real line,
>> instead of the integers, like rv_discrete but with support on
>> arbitrary floats.
>
> Yes, indeed.
>
> Please let me know your opinion.

I can see that a onepoint distribution can be quite useful as a plugin
degenerate distribution but also for other purposes like mixture
distributions with a continuous and a discrete part (masspoints).

Actually, if the onepoint distribution directly subclasses rv_generic
then it wouldn't rely on or interfere with the generic framework in
rv_continuous or rv_discrete (where it wouldn't really fit in if
onepoint is on reals), and it might be relatively easy to provide all
the methods of the distributions for a single point distribution.

Choice of name:
to me, "deterministic random variable" sounds like an oxymoron,
although I found some references to deterministic distribution (mainly
or exclusively in queuing theory and
http://isi.cbs.nl/glossary/term902.htm)
I would prefer a boring "onepoint" distribution, or "degenerate", or ... ?
Google brings up more statistics/probability references for one-point
or degenerate distribution.

Can you file a ticket with what you would like to have?


<rambling ahead>
I started to work again a bit on enhancing the distributions, mainly
I'm experimenting with several generic estimation methods. My target
is to have a working estimator for any distribution in scipy.stats and
for several additional distributions.

I worry a bit that a deterministic distribution might not fit into a
general framework for distributions and might need to be special cased
for some methods. (but see above)

In my new code, I went away from using distributions by name eg. in
arguments for function, so I don't care anymore whether a distribution
is defined in scipy.stats or in some other module, i.e. no more
getattr(scipy.stats, distname)

One problem is that, once new functions/classes are in scipy,
backwards compatibility considerations make development a lot more
sluggish, and for many parts I know what I don't like, but I'm not
sure yet what an improvement should look like.

In case you are interested, I'm having fun in the sandbox
http://bazaar.launchpad.net/~josef-pktd/statsmodels/statsmodels-josef-experimental/files/head:/scikits/statsmodels/sandbox/stats/

Cheers,

Josef


>
> bye
>
> Nicky
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>



More information about the SciPy-User mailing list