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

Liaw, Andy andy_liaw at merck.com
Wed Oct 5 15:12:42 CEST 2005


> From: Peter Dalgaard
> 
> 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)

Er, which smaller values of 8 would you suggest?  8-)

Andy

 
> 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
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
>



More information about the R-devel mailing list