[SciPy-Dev] signature for k-sample tests ???

josef.pktd at gmail.com josef.pktd at gmail.com
Fri Jan 3 16:18:46 EST 2014


On Fri, Jan 3, 2014 at 4:02 PM, Warren Weckesser
<warren.weckesser at gmail.com> wrote:
> On Fri, Jan 3, 2014 at 3:49 PM, <josef.pktd at gmail.com> wrote:
>>
>> I don't like it, but I don't care. Opinions please.
>>
>> The inherited pattern in scipy.stats for k-sample tests is to use *args
>>
>> anderson_ksamp(*args)
>> f_oneway(*args)
>> obrientransform(*args)
>>
>> what do we do if we want to add keyword arguments?
>>
>> >>> def f(*args, method='approx'):
>> SyntaxError: invalid syntax
>> unless this changes in newer versions of python
>>
>> In statsmodels I either require a tuple instead of *args, or stack the
>> data into a long format. (I don't use *args for the main required
>> arguments.)
>
>
>
> An option that maintains the scipy API is to define the function as
>
>     def f(*args, **kwargs):
>
> and then add code to check that any given keyword arguments are valid.  In
> this case, check that the only key in kwargs is 'method'.

I was thinking about that as the only solution that follows the scipy pattern.

However, ugly and not informative.

But I don't think that the scipy functions will get lots of keywords,
so still bearable.

In the anderson_ksamp case there might be "eventually" an option to
choose the p-value calculation, which would end up in the **kwargs.
In one of my versions of anova/f_oneway I have variance and trimming
options IIRC.

Josef


>
> Warren
>
>
>>
>> Josef
>> _______________________________________________
>> SciPy-Dev mailing list
>> SciPy-Dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-dev
>
>
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>



More information about the SciPy-Dev mailing list