[SciPy-user] noncentral F distribution?
josef.pktd@gmai...
josef.pktd@gmai...
Wed May 27 18:47:48 CDT 2009
On Wed, May 27, 2009 at 7:42 PM, Robert Kern <robert.kern@gmail.com> wrote:
> On Wed, May 27, 2009 at 18:38, Neal Becker <ndbecker2@gmail.com> wrote:
>> josef.pktd@gmail.com wrote:
>>
>>> On Wed, May 27, 2009 at 7:16 PM, Neal Becker <ndbecker2@gmail.com> wrote:
>>>> Does scipy have non central F distribution? (I need cdf for that)
>>>>
>>>
>>>>>> print scipy.stats.ncf.extradoc
>>>
>>>
>>> Non-central F distribution
>>>
>>> ncf.pdf(x,df1,df2,nc) = exp(nc/2 + nc*df1*x/(2*(df1*x+df2)))
>>> * df1**(df1/2) * df2**(df2/2) * x**(df1/2-1)
>>> * (df2+df1*x)**(-(df1+df2)/2)
>>> * gamma(df1/2)*gamma(1+df2/2)
>>> * L^{v1/2-1}^{v2/2}(-nc*v1*x/(2*(v1*x+v2)))
>>> / (B(v1/2, v2/2) * gamma((v1+v2)/2))
>>> for df1, df2, nc > 0.
>>>
>>>>>> scipy.stats.ncf.cdf
>>> <bound method ncf_gen.cdf of <scipy.stats.distributions.ncf_gen object
>>> at 0x021DDE90>>
>>>
>>> note 3rd or 4th moments are wrong
>>>
>>> Josef
>>
>> I found the page:
>> http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.ncf.html#scipy.stats.ncf
>>
>> but I don't know what the parameters mean.
>>
>> I was looking for something like:
>> http://www.boost.org/doc/libs/1_39_0/libs/math/doc/sf_and_dist/html/math_toolkit/dist/dist_ref/dists/nc_f_dist.html
>>
>> There, a ncf is constructed with 3 parameters, v1, v2, lambda.
>
> These correspond to df1, df2, and nc in the same order.
>
>> Then the cdf is given as a function of a single variable, x.
>>
>> In scipy.stats.ncf, there are many constructor parameters. Which correspond
>> to the v1,v2,lambda I was looking for?
>>
>> 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)
>>
>>
>> In scipy.stats.ncf the cdf has
>> ncf.cdf(x,dfn,dfd,nc,loc=0,scale=1)
>>
>> again, I don't know what they mean. I think x is my x,
>
> Yes.
>
>> but I don't know
>> what the others are.
>
> Just ignore loc and scale.
>
and you have broadcasting on the arguments (for most distribution and cases)
>>> scipy.stats.ncf.cdf(np.linspace(0,5,3), [[20],[30]], 10, 0.5)
array([[ 0. , 0.92573897, 0.99322105],
[ 0. , 0.9327125 , 0.99435371]])
Josef
More information about the SciPy-user
mailing list