Re: Package statistics: tricdf (bug?)

Evangelos Rozos <[email protected]>
Newsgroups gmane.comp.gnu.octave.maintainers
Message-ID <[email protected]>
Thank you for you reply. This patch fixes tricdf for scalar arguments 
(triinv has also problem). Are the developers aware of it, should we 
file a bug?

On 25/06/2020 01:39, Dmitri A. Sergatskov wrote:
>
>
> On Tue, Jun 23, 2020 at 5:37 AM Evangelos Rozos <[email protected] 
> <mailto:[email protected]>> wrote:
>
>     I think something is wrong with tricdf function (maybe triinv also).
>
>      >> tricdf (0.7, 0.5, 1.0, 0.9)
>
>     ans =  0.16000
>
>     The correct answer should be 0.2.
>
>     MATLAB gives 0.2. This value can be also verified by the geometry
>     of the
>     pdf triangle with base from 0.5 to 1, and height 4 at 0.9. Then, the
>     area of the triangle with base from 0.5 to 0.7 and height 2 (0.7
>     is in
>     the middle of the 0.5 to 0.9 segment) is 0.2.
>
>
> tricdf code has few problems.  For you reported problem this fix 
> should work:
> < area = (x(k_temp) - a).^2 * h;
> ---
> >     area = (x(k_temp) - a).^2 * h / (c - a) / 2 ;
> 74c74
> <     area = (b-x(k_temp)).^2 * h;
> ---
> >     area = (b-x(k_temp)).^2 * h / (b - c) / 2 ;
>
> A similar change should be done for the code segment that deals with 
> the case of
> A,B, and C being arrays rather than scalar. I really do not understand 
> the intent of that code.
> It requires the size of X, A, B, and C to be the same. That does not 
> make much sense to me.
> I think A, B and C should be scalars. I do not think there is a 
> compatible matlab's function.
>
> Dmitri.
> -- 
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.