[R] Cauchy distribution limits

Martin Maechler maechler at stat.math.ethz.ch
Wed Feb 1 09:42:21 CET 2006


>>>>> "William" == William Asquith <wasquith at austin.rr.com>
>>>>>     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




More information about the R-help mailing list