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

Bjørn-Helge Mevik bhs2 at mevik.net
Thu Oct 6 13:30:57 CEST 2005


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



More information about the R-devel mailing list