[Rd] R crashes for large formulas in lm() (PR#8180)

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Oct 6 13:51:32 CEST 2005


Please see earlier in this thread, where the cause has already been
identified.

This resulted from C stack overflow, which is _very_ OS-specific (and may
even vary by shell). The author used recursion on terms which is not
necessary but not a problem for a modest number of terms.

On Thu, 6 Oct 2005, [iso-8859-1] Bjørn-Helge Mevik wrote:

> Peter Dalgaard wrote:
>
> > You could still have a point, but with 255^2 terms (all but 255 of
> > which will be redundant since x^2 == x:x == x in modeling language).
> > Presumably someone thought that noone in their right mind would
> > specify 65000 terms...
>
> I don't think this is a fixed limit on the number of terms: On "my" R
> (see below),
>
> set.seed(123)
> x1 <- runif(1000)
> x2 <- runif(1000)
> x3 <- runif(1000)
> x4 <- runif(1000)
> x5 <- runif(1000)
> x6 <- runif(1000)
> x7 <- runif(1000)
> x8 <- runif(1000)
> x9 <- runif(1000)
> x10 <- runif(1000)
> y <- rnorm(1000)
> fit <- lm(y~(x1*x2*x3*x4*x5*x6*x7*x8*x9)^2)
>
> works fine, but
>
> fit <- lm(y~(x1*x2*x3*x4*x5*x6*x7*x8*x9*x10)^2)
>
> crashes.
>
>
> > version
>          _
> platform i686-pc-linux-gnu
> arch     i686
> os       linux-gnu
> system   i686, linux-gnu
> status
> major    2
> minor    1.1
> year     2005
> month    06
> day      20
> language R
>
> The OS is Debian 3.1, the machine has 512MB RAM, and R was compiled
> "out of the box" from the official sources.
>
> --
> Bjørn-Helge Mevik
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list