Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2006-07-11 12:26:01


Paul A Bristow wrote:
> What about the Qs? (complements)
>
>> As I mentioned before, these should be member functions,
>> which could be called "density" (also called 'mass')

Or distribution :-)

>> and "cumulative".
>
> OHOH many books don't mention either of these words!
>
> The whole nomenclature seems a massive muddle,
> with mathematicians, statistics, and users or all sorts using
> different
> terms
> and everyone thinks they are the 'Standard' :-(
>
> And the highest priority in my book is the END USERS,
> not the professionals.
>
>> The cumulative density function is a strictly increasing
>> function and
>> therefore can be inverted. The inverse function could be called
>> "inverse_cumulative", which is a completely unambiguous name.
>
> But excessively long :-(

True, how about "persentile", or is that to ambiguous?

>> Finally, you observe that it is often useful to specify the
>> cumulative
>> probability for a given value of the random variable and
>> solve for the
>> parameter (the "degrees of freedom" for a Students T
>> distribution) that
>> determines the distribution. Since each family of
>> distributions depends
>> on a different set of parameters (for example, normal distributions
>> depend on two parameters, the mean and variance), the
>> interface for this is trickier to define.
>
>> I can think of two possibilities (I prefer the first):
>>
>> 1) Define ad hoc inverse functions for each specific
>> distribution. So
>> for the Students T distribution, you would define a member
>> function of the form:
>>
>> double degrees_of_freedom(double cumulative_probability, double
>> random_variable) const;
>
> I don't like 2 either, so I have snipped it ;-)
>
> This seems OK to me.

That could be a static member function, since we're solving for the degrees
of freedom parameter. It would also be more natural to me for the
cumulative_probability parameter to come last in the list.

> I'd be grateful if you could sketch out how you see the whole
> Student's t class would look (just for double and omit the equations
> of course). (This will avoid any confusion about what we are talking
> about).
>
> However:
>
> But I still worried that the whole scheme will lead to much bigger
> code compared to a set of names of (template) functions
> (because code that isn't in fact used will be generated).
> Can anyone advise on this?

For template classes member functions are only instantiated when used, so if
you only use one member, then that's the only one instantiated.

John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk