Cauchy distribution limits

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Cauchy distribution limits

William H. Asquith
I have question (curiosity) regarding returned values of R's qcauchy
() function,
for nonexceedance probability (F). It seems the ideal returned range  
of cauchy distribution should be [-Inf,Inf].

For F=0
 > qcauchy(0)
[1] -Inf

but for F=1
 > qcauchy(1)
[1] 8.16562e+15

It seems to me that the proper return value should be Inf???

For default (location=0,scale=1) quantile function of cauchy

x(F) = tan(pi * (F - 0.5))

For F = 0
 > tan(pi*(-0.5))
[1] -1.633124e+16

For F = 1
 > tan(pi*(0.5))
[1] 1.633124e+16

So I conclude that qcauchy(0) properly handles the -Inf result and  
the qcauchy(1) returns a very large number, curiously not equal to tan
(0.5*pi), but certainly not Inf.

As double check,
 > tan(pi*(0.99999-0.5))
[1] 31830.99
 > qcauchy(0.99999)
[1] 31830.99

william

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Cauchy distribution limits

Martin Maechler
>>>>> "William" == William Asquith <[hidden email]>
>>>>>     on Tue, 31 Jan 2006 21:14:50 -0600 writes:

    William> I have question (curiosity) regarding returned values of R's qcauchy
    William> () function,
    William> for nonexceedance probability (F). It seems the ideal returned range  
    William> of cauchy distribution should be [-Inf,Inf].

    William> For F=0
    >> qcauchy(0)
    William> [1] -Inf

    William> but for F=1
    >> qcauchy(1)
    William> [1] 8.16562e+15

    William> It seems to me that the proper return value should be Inf???

yes,  but istn't  8 * 10^15 a good approximation to +Inf ?  :-) :-)

    William> For default (location=0,scale=1) quantile function of cauchy

    William> x(F) = tan(pi * (F - 0.5))

    William> For F = 0
    >> tan(pi*(-0.5))
    William> [1] -1.633124e+16

    William> For F = 1
    >> tan(pi*(0.5))
    William> [1] 1.633124e+16

    William> So I conclude that qcauchy(0) properly handles the -Inf result and  
    William> the qcauchy(1) returns a very large number,
    William>  curiously not equal to tan  (0.5*pi), but certainly not Inf.

The reason for the current behavior is the following part of
qcauchy.c :

    return location + (lower_tail ? -scale : scale) / tan(M_PI * p);
    /* -1/tan(pi * p) = -cot(pi * p) = tan(pi * (p - 1/2))  */


(note the comment!)

I'll fix this, since I had wanted to do it in the past (and
then thought it wasn't important enough to warrant an extra if()
in the code).

Martin Maechler, ETH Zurich

    William> As double check,
    >> tan(pi*(0.99999-0.5))
    William> [1] 31830.99
    >> qcauchy(0.99999)
    William> [1] 31830.99

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html