[R] chisq.test freezing on certain inputs

Martin Maechler maechler at stat.math.ethz.ch
Thu Dec 11 18:05:27 CET 2003


>>>>> "Jeffrey" == Jeffrey Chang <jeffrey.chang at duke.edu>
>>>>>     on Thu, 11 Dec 2003 09:58:43 -0500 writes:

    Jeffrey> Hello everybody, I'm running R 1.8.1 on both Linux
    Jeffrey> and OS X compiled with gcc 3.2.2 and 3.3,
    Jeffrey> respectively.  The following call seems to freeze
    Jeffrey> the interpreter on both systems:
    >> chisq.test(matrix(c(233, 580104, 3776, 5786104), 2, 2),
    >> simulate=TRUE)

    Jeffrey> By freeze, I mean, the function call never returns
    Jeffrey> (running > 10 hours so far), the process is
    Jeffrey> unresponsive to SIGINT (but I call kill it with
    Jeffrey> TERM), and the process still consumes cycles on the
    Jeffrey> CPU.

    Jeffrey> Browsing through the code, it seems to be getting
    Jeffrey> stuck on the C call to "chisqsim" .

that's true

    Jeffrey> Has anyone seen this, or know what may be causing
    Jeffrey> it?

I can reproduce it and am pretty sure, the reason is 
integer overflow or something of that nature.

I've recently been looking at a similar bug with fisher.test()
(returning p.value = Inf !) and reason *was* integer overflow
{fix not yet committed}.

--> I'll have a look at this, as well.

Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><




More information about the R-help mailing list