William Stein wrote:
> On Wed, Sep 16, 2009 at 12:00 PM, Dag Sverre Seljebotn
> <da...@student.matnat.uio.no> wrote:
>> Jason Grout wrote:
>>> Carlo Hamalainen wrote:
>>>> On Wed, Sep 16, 2009 at 7:46 PM, Jason Grout
>>>> <jason-s...@creativetrax.com> wrote:
>>>>> R has a C interface for lots of functions (like the distribution
>>>>> functions that I wanted today).  I imagine that a stats module would use
>>>>> Cython to call the C functions for these sorts of things, but then use
>>>>> rpy2 for the rest of the interaction with R.
>>>> Which distribution functions did you want? Are these of any use?
>>>> http://trac.sagemath.org/sage_trac/ticket/6827
>>> Wow, nice!
>>>
>>> I needed normal, binomial, and uniform distributions.
>>>
>>> It seems a little awkward to get these.  For example:
>>>
>>> T = RealDistribution('uniform', [0, 2])
>>>
>>> I guess it would be nice if there were convenience functions, so
>>>
>>> sage.probability.uniform([0,2])
>>>
>>> constructed this.
>> I already regularily use two APIs for probability distributions: R and
>> SciPy. Both do essentially the same thing (quantiles, integrals,
>> densities, and random variates -- all numerical).
>>
>> I can understand that the R API perhaps isn't elegant enough to import
>> into Sage as is, but perhaps the SciPy API could at least be emulated
>> rather than creating a new API?
>>
>> http://docs.scipy.org/doc/scipy/reference/stats.html
>> http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.uniform.html
>>
>> (With regards to creating Cython wrappers directly to C functions, I'd
>> rather use the SciPy functionality, which is essentially the same thing,
>> only that no reimplementation of the wheel is needed.)
>>
> 
> I'm confused.  Above Jason says: "Scipy also does some of this stuff,
> but R is *much* better.  For example, R has *nine* different quartile
> algorithms you can choose from (compared to scipy's one, and
> matplotlib's sort of broken one (it doesn't calculate quartiles
> between data points)).  R also has the advantage of being vetted/used
> by a huge statistics community."  I have also looked a lot at Scipy's
> stats, and it seems overall not nearly as good as R's.  But you're
> claiming they are "essentially the same thing".

No, no. I don't doubt that Sage should go for R for the majority of the 
functionality.

My point is only about API: Naming conventions and that sort of thing. 
If it is for some reason not OK to go with simply using R's API, e.g. 
use the uniform distribution through runif/qunif/punif/dunif, perhaps go 
with SciPy's convention of 
uniform.rvs/uniform.ppf/uniform.cdf/unform.pdf instead. Not invent a 
third one.

(My personal taste would be to just to export R API as closely as 
possible though, just because I know R better.)

And in the *few* cases where it would make sense to reimplement anything 
in Cython for speed rather than interface with R (not my idea!), it 
seems likely that the functionality in question is primitive enough for 
SciPy to contain it (which has the advantage that no object marshalling 
has to happen, like Cython).

-- 
Dag Sverre

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to