From maechler at stat.math.ethz.ch  Thu Dec 17 14:18:06 2009
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Thu, 17 Dec 2009 14:18:06 +0100
Subject: [Rd] segfault in glm.fit (PR#14154)
In-Reply-To: <20091217073510.19DEB2831FE5@mail.pubhealth.ku.dk>
References: <20091217073510.19DEB2831FE5@mail.pubhealth.ku.dk>
Message-ID: <19242.12174.221758.505109@lynne.math.ethz.ch>

>>>>> "AB" == Adrian Baddeley <adrian at maths.uwa.edu.au>
>>>>>     on Thu, 17 Dec 2009 08:35:09 +0100 (CET) writes:

    AB> Bug summary:
    AB> glm() causes a segfault if the argument 'data'
    AB> is a data frame with more than 16384 rows.

not on my desktop

    AB> Bug demonstration:

    AB> -------input ---------------
    AB> N <- 16400
    AB> df <- data.frame(x=runif(N, min=1,max=2),y=rpois(N, 2))
    AB> glm(y ~ x, family=poisson, data=df)

I don't get a problem, nor do I if I do the above in a for()
loop, 100 times,

nor do I get a problem when I do it 100 times with  
N <- 50000
(where  you need to wait a few minutes)
using the following
x86_64-unknown-linux-gnu
 N <- 50000; for(n in 1:100) { cat("\nn = ",n,"\n----\n"); df <- data.frame(x=runif(N, min=1,max=2),y=rpois(N, 2)); print(glm(y ~ x, family=poisson, data=df)) }


So, I guess it's problem only on *some* platforms.
Mine is also  x86_64-unknown-linux-gnu

[with 8 Giga bytes of RAM, and a quad-core 
 AMD Phenom(tm) II X4 925 Processor ].

Martin

    AB> ------ output ---------------
    AB> *** caught segfault ***
    AB> address (nil), cause 'unknown'

    AB> Traceback:
    AB> 1: ifelse(y == 0, 1, y/mu)
    AB> 2: dev.resids(y, mu, weights)
    AB> 3: glm.fit(x = X, y = Y, weights = weights, start = start, etastart = 
    AB> etastart,     mustart = mustart, offset = offset, family = family, 
    AB> control = control,     intercept = attr(mt, "intercept") > 0)
    AB> 4: glm(y ~ x, family = poisson, data = df)

    AB> --------------------------------

    AB> The code generates a segfault if the value of 'N' is greater than 16384.

    AB> regards
    AB> Adrian Baddeley

    AB> ////////////////////////////////////////////////////////////

    AB> --please do not edit the information below--

    AB> Version:
    AB> platform = x86_64-unknown-linux-gnu
    AB> arch = x86_64
    AB> os = linux-gnu
    AB> system = x86_64, linux-gnu
    AB> status =
    AB> major = 2
    AB> minor = 10.1
    AB> year = 2009
    AB> month = 12
    AB> day = 14
    AB> svn rev = 50720
    AB> language = R
    AB> version.string = R version 2.10.1 (2009-12-14)

    AB> Locale:
    AB> LC_CTYPE=en_AU.UTF-8;LC_NUMERIC=C;LC_TIME=en_AU.UTF-8;LC_COLLATE=en_AU.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_AU.UTF-8;LC_PAPER=en_AU.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_AU.UTF-8;LC_IDENTIFICATION=C

    AB> Search Path:
    AB> .GlobalEnv, package:stats, package:graphics, package:grDevices, 
    AB> package:utils, package:datasets, package:methods, Autoloads, package:base

    AB> ______________________________________________
    AB> R-devel at r-project.org mailing list
    AB> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] segfault in glm.fit (PR#14154)
Martin Maechler