|
Boost : |
From: John Maddock (john_at_[hidden])
Date: 2006-07-12 12:18:53
Paul A Bristow wrote:
>> >> As I mentioned before, these should be member functions,
>> >> which could be called "density" (also called 'mass')
>>
>> Or distribution :-)
>
> This seems quite clear to me - both density and mass sound too
> physical to me,
> though they are in common use.
>
> What is important is that the documentation gives ALL the other
> possible names.
Yep, we'll need a glossary for sure.
>> >> The inverse function could be called "inverse_cumulative"
>> > But excessively long :-(
>> True, how about "persentile", or is that to ambiguous?
>
> Percentile might be better - it is in the dictionary ;-))
>
> But quantile is a more modern term and doesn't raise any questions
> about multiplying /dividing by/with 100, a source of unnecessary
> confusion - as we have found with Boost.Test.
>
> So I'm strongly in favour of quantile.
Agreed.
> But I also wonder if 'fraction' is a possible name?
Oh god another one :-) No lets stick with quantile IMO, and add the other
to the glossary.
>> It would also be more natural to me for the
>> cumulative_probability parameter to come last in the list.
>
> Why? Quantile is also cumulative?
Actually I'm not sure it matters after all which order they come in :-)
I've just got used to your free functions, where either the form is:
something_inv(random-or-shape-param, P-or-Q-param);
> Which also means that the cost of a Q or complement function is
> nothing unless you use it.
> (and you probably won't use the P version as well).
Right and I think in most cases they're trivial to provide? If that turns
out not to be the case drop 'em and see if anyone complains :-)
>> dist.pdf(x) -- Probability Density Function, this is what looks like
>> a "bell shaped curve" for a normal distribution, for
>> example. A.k.a. "p"
>> dist.cdf(x) -- Cumulative Distribution Function. P
>> dist.ccdf(x) -- Complementary Cumulative Distribution Function;
>> ccdf(x) = 1 - cdf(x)
>> dist.icdf(p) -- Inverse Cumulative Distribution Function: P';
>> icdf(cdf(x)) = x and vice versa
>> dist.iccdf(p) -- Inverse Complementary Cumulative Distribution
>> Function; iccdf(p) = icdf(1-p); iccdf(ccdf(x)) = x
>
> My instinct is that these are too abbreviated, despite their
> logicalness.
Agreed.
> But this is the key problem - being clear, not curt, and yet concise.
>
> students_t.inverse_complement_cumulative_probability certains fails!
> ;-))
>
> so we a getting to:
>
> template <T> // T an integral or real or floating-point type.
>
> T distribution(T x) const; // Probability Density Function or pdf
> or p T cumulative_probability(T x) const; // Cumulative
> Distribution
> Function. P
>
> cumulative_probability is too long :-(
>
> Do we REALLY need the cumulative here?
>
> T probability(T x) const; // Cumulative Distribution Function or
> cdf or
> P
I like probability as a name.
> T quantile(T probability) const; // Also known as Inverse
> cumulative Distribution Function
>
> what do we call
>
> T complementary_cumulative_probability(T x) const; //
> Complementary Cumulative Distribution Function. Q
>
> ??? :-((
How about complementary_probablity ? Or still too long?
Or probability_c ?
> and worse what about Inverse Complementary Cumulative Distribution
>
> complementary_quantile??? :-((
quantile_c ?
> and the ad hoc 'extra's
>
> static T degrees_of_freedom(T quantile, T probability) const;
>
> So I feel we haven't QUITE got there yet.
Closer though.
John.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk