OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

office-comment message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [office-comment] ODFF: list of suggestions


Hi everyone,


David King wrote:
> May I add these suggestions to the list?
>
> B function
> * "this function returns the probability that the number of successful 
> trials shall lie between S and S2." - should say clearly if inclusive or 
> exclusive (inclusive I think).
> * Test cases:   " =B(7;0.5;3)   0.24343750" - wrong result - 0.2734375 
> is correct, as returned by Calc, and checked from the actual formula by 
> me.
>   

confirmed in R 2.6.2
 > dbinom(3, 7, 0.5)
[1] 0.2734375

 > pbinom(7, 8, 0.2)-pbinom(2, 8, 0.2)
[1] 0.2030797
(NOT 0.20307698)

On a different note, I noticed that OOo Calc and other spreadsheet 
applications really mix up the density and the distribution functions: 
e.g. B() does not have specifically a (cumulative) distribution 
function. Of course B(x, p, 0 , k) will compute the distribution function.

Wouldn't it be advisable to define *ALL density and ALL distribution 
functions* like:
SOME_FUNCTION(..., distribution = FALSE)
SOME_FUNCTION(..., distribution = TRUE)

for the 2 corresponding functions.

Also, use consistently then the 'distribution'-keyword inside the 
Open-Formula document to specify cumulative probabilities (distribution).

Then, B(x, p, k1, k2) could be computed using the new function as:
B(x, p, k2, dist = TRUE) - B(x, p, k1 - 1, dist = TRUE)
['k1 - 1' IF both k1 & k2 are included - as requested by David, this 
should be specified]

While some may complain about the greater flexibility of the existing 
implementation, the truth is, i.) this is equally flexible and  ii.) 
this is more consistent.

I especially like R's handling of the issue: ALL distribution types have 
the following functions defined (as separate functions):
Density (d), distribution function (p), quantile function (q) and random 
generation (r), e.g.:

> dbinom(x, size, prob, log = FALSE)
> pbinom(q, size, prob, lower.tail = TRUE, log.p = FALSE)
> qbinom(p, size, prob, lower.tail = TRUE, log.p = FALSE)
> rbinom(n, size, prob)
>   

Sincerely,

Leonard


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]