[SciPy-user] noncentral F distribution?

josef.pktd@gmai... josef.pktd@gmai...
Thu May 28 09:56:48 CDT 2009


On Wed, May 27, 2009 at 8:07 PM, Robert Kern <robert.kern@gmail.com> wrote:
> On Wed, May 27, 2009 at 18:59, Neal Becker <ndbecker2@gmail.com> wrote:
>> Robert Kern wrote:
>>
>>> On Wed, May 27, 2009 at 18:47, Neal Becker <ndbecker2@gmail.com> wrote:
>>>
>>>> Thanks!  Just one more.  What are dfn, dfd?  The doc calls them "shape
>>>> parameters", but I don't know what that means.
>>>
>>> A "shape parameter" is a generic term for any parameter that is not a
>>> location or scale parameter. In this case, dfn is the parameter for
>>> the degrees of freedom in the numerator of the expression for the F
>>> distribution (whether it is noncentral or not) and dfd is the degrees
>>> of freedom in the denominator.
>>
>> I think I get it now.  I had assumed that you must first construct an
>> instance of a ncf object (specifying parameters) and then call the cdf
>> method (specifying x).
>>
>> Now I see that you simply call:
>>
>> ncf.cdf (x, dfn, dfd, nc)
>>
>> Is that correct?
>
> You can do either, actually.
>
>  ncf(dfn, dfd, nc).cdf(x)
>  ncf.cdf(x, dfn, dfd, nc)
>
> The rv_continuous docstring is a bit clearer on this point than the
> individual distributions' docstrings.
>
>> BTW, I was confused by:
>>
>> scipy.stats.ncf(momtype=1, a=None, b=None, xa=-10.0, xb=10.0, xtol=1e-14,
>> badvalue=None, name=None, longname=None, shapes=None, extradoc=None)
>>
>>  which is the first thing seen in the doc.  It appears to be the constructor
>> declaration?  These parameters don't seem to be defined anywhere.
>
> Heh. Yeah. The thing this, scipy.stats.ncf is actually an instance of
> a class, not a class itself. The doc generator is picking up the
> __init__ of the class rather than the __call__. But even then,
> __call__ just takes *args, **kwds and parses them according to the
> data it is configured with. The doc generator will probably need some
> special support to document the distributions properly.
>

I usually do the following, so I didn't see that help(..) doesn't
include the generated docstring

>>> print scipy.stats.ncf.__doc__

A non-central F distribution continuous random variable.

Continuous random variables are defined from a standard form and may
require some shape parameters to complete its specification.  Any
optional keyword parameters can be passed to the methods of the RV
object as given below:

Methods
-------
ncf.rvs(dfn,dfd,nc,loc=0,scale=1,size=1)
    - random variates

ncf.pdf(x,dfn,dfd,nc,loc=0,scale=1)
    - probability density function

ncf.cdf(x,dfn,dfd,nc,loc=0,scale=1)
    - cumulative density function

...


More information about the SciPy-user mailing list