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

Peter Dalgaard p.dalgaard at biostat.ku.dk
Wed Oct 5 15:02:55 CEST 2005


Hallgeir.Grinde at elkem.no writes:

> Dette er en melding med flere deler i MIME-format.
> --=_alternative 004613C000257091_=
> Content-Type: text/plain; charset="US-ASCII"
> 
> And some more informastion I forgot.
> R does not crash if I write out the formula:
> 
> 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)
> -> R crashes
> 
> fit <- lm(y~x1+x2+x3+x4+x5+x6+x7+x8
>                 +x1:x2+x1:x3+x1:x4+x1:x5+x1:x6+x1:x7+x1:x8
>                 +x2:x3++x2:x4+x2:x5+x2:x6+x2:x7+x2:x8
>                 +x3:x4+x3:x5+x3:x6+x3:x7+x3:x8
>                 +x4:x5+x4:x6+x4:x7+x4:x8
>                 +x5:x6+x5:x7+x5:x8
>                 +x6:x7+x6:x8
>                 +x7:x8)
> -> R does not crash
> This is the same formula, at least it should be.

It isn't and it shouldn't. (Try it for smaller values of 8)

y~(x1+x2+x3+x4+x5+x6+x7+x8)^2 should be same as the second formula,
modulo the syntax error.


-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-devel mailing list