Re: [R] Cauchy distribution limits

From: Martin Maechler <maechler_at_stat.math.ethz.ch>
Date: Wed 01 Feb 2006 - 19:42:21 EST

>>>>> "William" == William Asquith <wasquith@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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Feb 01 19:49:56 2006

This archive was generated by hypermail 2.1.8 : Thu 02 Feb 2006 - 02:13:46 EST