[SciPy-dev] stats.distributions.poisson loc parameter : is it wise ?

Robert Kern robert.kern at gmail.com
Thu Aug 6 17:34:08 EDT 2009


On Thu, Aug 6, 2009 at 16:21, nicky van foreest<vanforeest at gmail.com> wrote:
> Hi,
>
> I agree. Anything that makes the behavior of the distribution
> functions more intuitive is helpful, at least to me.
>
> BTW, I find the term loc already by itself very confusing---what does
> it actually mean? For instance,
>>>> Help on gamma_gen in module scipy.stats.distributions object
> ...
>
>  |  cdf(self, x, *args, **kwds)
>  |      Cumulative distribution function at x of the given RV.
>  |
>  |      Parameters
>  |      ----------
>  |      x : array-like
>  |          quantiles
>  |      arg1, arg2, arg3,... : array-like
>  |          The shape parameter(s) for the distribution (see docstring of the
>  |          instance object for more information)
>  |      loc : array-like, optional
>  |          location parameter (default=0)
>  |      scale : array-like, optional
>  |          scale parameter (default=1)
>
> I am inclined to characterize the gamma distbution by means of n
> (number of stages if one is used to the Erlang distribution) and the
> rate parameter lambda, say, and I am clueless as to the meaning of
> scale and location here.

Every probability distribution can be generalized to accept a location
and scale parameter even if their standard treatments do not.

  pdf(x; loc,scale) -> pdf((x-loc)/scale)/scale

The other related functions transform in easily derivable ways. This
is covered at the top of the document scipy/stats/continuous.lyx in
the source distribution.

The reason we do this is partly generality and mostly convenience of
implementation; all of the distributions can share the shifting and
scaling code instead of implementing it separately. I once floated the
idea of removing this for the distributions whose standard definitions
do not include such parameters, specifically gamma. However, there was
an objection from someone who apparently has used a "shifted gamma"
distribution to model sunspot radii where loc>0, if I remember
correctly, so I dropped my proposal.

If you don't need to use them, don't. If you want to prevent
confusion, help port the LyX documentation into the main
documentation.

-- 
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 SciPy-Dev mailing list