From MSchwartz at mn.rr.com  Wed Oct  5 14:31:51 2005
From: MSchwartz at mn.rr.com (MSchwartz@mn.rr.com)
Date: Wed,  5 Oct 2005 14:31:51 +0200 (CEST)
Subject: [Rd] R crashes for large formulas in lm() (PR#8180)
Message-ID: <20051005123151.8BA4C1DD9F@slim.kubism.ku.dk>

On Wed, 2005-10-05 at 14:12 +0200, ligges at statistik.uni-dortmund.de
wrote:
> Prof Brian Ripley wrote:
> 
> > On Wed, 5 Oct 2005 hallgeir.grinde at elkem.no wrote:
> > 
> > 
> >>Full_Name: Hallgeir Grinde
> >>Version: 2.1.1
> >>OS: Windows XP
> >>Submission from: (NULL) (144.127.1.1)
> >>
> >>
> >>While using lm(y~(x*z*c*...*v)^2) R crashes/closes if the numbers of variables
> >>are at least 8.
> > 
> > 
> > OK, let's try to reproduce that:
> > 
> > 
> >>x1 <- runif(1000)
> >>x2 <- runif(1000)
> >>x3 <- runif(1000)
> >>x4 <- runif(1000)
> >>x5 <- runif(1000)
> >>x6 <- runif(1000)
> >>x7 <- runif(1000)
> >>x8 <- runif(1000)
> >>y <- rnorm(1000)
> >>fit <- lm(y~(x1*x2*x3*x4*x5*x6*x7*x8)^2)
> > 
> > 
> > No crash, a quite reasonable fit.
> > 
> > Can we please have a reproducible example, as we do ask?
> > 
> 
> Hmm, crashes for me as well with R-2.1.1 and R-2.2.0 beta (2005-09-27 
> r35682M) on WinNT 4.0, SP6.
> 
> 
> Let's make it reproducible:
> 
> 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)
> y <- rnorm(1000)
> fit <- lm(y~(x1*x2*x3*x4*x5*x6*x7*x8)^2)


No problems on FC4 using Version 2.1.1 Patched (2005-10-04):

> summary(fit)

Call:
lm(formula = y ~ (x1 * x2 * x3 * x4 * x5 * x6 * x7 * x8)^2)

Residuals:
      Min        1Q    Median        3Q       Max
-3.315028 -0.532338  0.005368  0.548012  2.957057

Coefficients:
                          Estimate Std. Error t value Pr(>|t|)
(Intercept)                16.2460    15.7375   1.032   0.3023
x1                        -10.0310    29.7557  -0.337   0.7361
x2                        -26.2678    24.0473  -1.092   0.2750
x3                        -42.5713    32.9481  -1.292   0.1967

...

x1:x2:x4:x5:x6:x7:x8     -339.8099  1024.8652  -0.332   0.7403
x1:x3:x4:x5:x6:x7:x8     -833.5375  1095.1153  -0.761   0.4468
x2:x3:x4:x5:x6:x7:x8     -546.0684  1050.8648  -0.520   0.6035
x1:x2:x3:x4:x5:x6:x7:x8   533.8390  1861.5862   0.287   0.7744
---
Signif. codes:  0 ???***??? 0.001 ???**??? 0.01 ???*??? 0.05 ???.??? 0.1 ??? ??? 1

Residual standard error: 1.001 on 744 degrees of freedom
Multiple R-Squared: 0.2541,     Adjusted R-squared: -0.001499
F-statistic: 0.9941 on 255 and 744 DF,  p-value: 0.5161


Is this perhaps a RAM issue? I have 2 Gb.

Marc



[Rd] R crashes for large formulas in lm() (PR#8180)
MSchwartz@mn.rr.com