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

Hallgeir.Grinde@elkem.no Hallgeir.Grinde at elkem.no
Wed Oct 5 14:45:42 CEST 2005


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.





Uwe Ligges <ligges at statistik.uni-dortmund.de>
05.10.2005 12:13
 
        Til:    Prof Brian Ripley <ripley at stats.ox.ac.uk>
        cc:     hallgeir.grinde at elkem.no, R-bugs at biostat.ku.dk
        Emne:   Re: [Rd] R crashes for large formulas in lm() (PR#8180)


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)


Uwe Ligges



                                NOTICE
               Please immediately e-mail back to sender 
               if you are not the intended recipient. 

               Thereafter delete the e-mail along with 
               any attachments without making copies. 

               Elkem reserves all rights of privilege, 
               confidentiality and copyright.


--=_alternative 004613C000257091_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2 face="sans-serif">And some more informastion I forgot.</font>
<br><font size=2 face="sans-serif">R does not crash if I write out the
formula:</font>
<br>
<br><font size=2><tt>set.seed(123)<br>
x1 &lt;- runif(1000)<br>
x2 &lt;- runif(1000)<br>
x3 &lt;- runif(1000)<br>
x4 &lt;- runif(1000)<br>
x5 &lt;- runif(1000)<br>
x6 &lt;- runif(1000)<br>
x7 &lt;- runif(1000)<br>
x8 &lt;- runif(1000)<br>
y &lt;- rnorm(1000)<br>
fit &lt;- lm(y~(x1*x2*x3*x4*x5*x6*x7*x8)^2)</tt></font>
<br><font size=2><tt>-&gt; R crashes</tt></font>
<br>
<br><font size=2><tt>fit &lt;- lm(y~x1+x2+x3+x4+x5+x6+x7+x8</tt></font>
<br><font size=2><tt>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; +x1:x2+x1:x3+x1:x4+x1:x5+x1:x6+x1:x7+x1:x8</tt></font>
<br><font size=2><tt>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; +x2:x3++x2:x4+x2:x5+x2:x6+x2:x7+x2:x8</tt></font>
<br><font size=2><tt>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; +x3:x4+x3:x5+x3:x6+x3:x7+x3:x8</tt></font>
<br><font size=2><tt>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; +x4:x5+x4:x6+x4:x7+x4:x8</tt></font>
<br><font size=2><tt>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; +x5:x6+x5:x7+x5:x8</tt></font>
<br><font size=2><tt>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; +x6:x7+x6:x8</tt></font>
<br><font size=2><tt>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; +x7:x8)</tt></font>
<br><font size=2><tt>-&gt; R does not crash</tt></font>
<br><font size=2><tt>This is the same formula, at least it should be.</tt></font>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td>
<td><font size=1 face="sans-serif"><b>Uwe Ligges &lt;ligges at statistik.uni-dortmund.de&gt;</b></font>
<p><font size=1 face="sans-serif">05.10.2005 12:13</font>
<td><font size=1 face="Arial">&nbsp; &nbsp; &nbsp; &nbsp; </font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Til:
&nbsp; &nbsp; &nbsp; &nbsp;Prof Brian Ripley &lt;ripley at stats.ox.ac.uk&gt;</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; cc:
&nbsp; &nbsp; &nbsp; &nbsp;hallgeir.grinde at elkem.no, R-bugs at biostat.ku.dk</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Emne:
&nbsp; &nbsp; &nbsp; &nbsp;Re: [Rd] R crashes for large formulas
in lm() (PR#8180)</font></table>
<br>
<br>
<br><font size=2><tt>Prof Brian Ripley wrote:<br>
<br>
&gt; On Wed, 5 Oct 2005 hallgeir.grinde at elkem.no wrote:<br>
&gt; <br>
&gt; <br>
&gt;&gt;Full_Name: Hallgeir Grinde<br>
&gt;&gt;Version: 2.1.1<br>
&gt;&gt;OS: Windows XP<br>
&gt;&gt;Submission from: (NULL) (144.127.1.1)<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;While using lm(y~(x*z*c*...*v)^2) R crashes/closes if the numbers
of variables<br>
&gt;&gt;are at least 8.<br>
&gt; <br>
&gt; <br>
&gt; OK, let's try to reproduce that:<br>
&gt; <br>
&gt; <br>
&gt;&gt;x1 &lt;- runif(1000)<br>
&gt;&gt;x2 &lt;- runif(1000)<br>
&gt;&gt;x3 &lt;- runif(1000)<br>
&gt;&gt;x4 &lt;- runif(1000)<br>
&gt;&gt;x5 &lt;- runif(1000)<br>
&gt;&gt;x6 &lt;- runif(1000)<br>
&gt;&gt;x7 &lt;- runif(1000)<br>
&gt;&gt;x8 &lt;- runif(1000)<br>
&gt;&gt;y &lt;- rnorm(1000)<br>
&gt;&gt;fit &lt;- lm(y~(x1*x2*x3*x4*x5*x6*x7*x8)^2)<br>
&gt; <br>
&gt; <br>
&gt; No crash, a quite reasonable fit.<br>
&gt; <br>
&gt; Can we please have a reproducible example, as we do ask?<br>
&gt; <br>
<br>
Hmm, crashes for me as well with R-2.1.1 and R-2.2.0 beta (2005-09-27 <br>
r35682M) on WinNT 4.0, SP6.<br>
<br>
<br>
Let's make it reproducible:<br>
<br>
set.seed(123)<br>
x1 &lt;- runif(1000)<br>
x2 &lt;- runif(1000)<br>
x3 &lt;- runif(1000)<br>
x4 &lt;- runif(1000)<br>
x5 &lt;- runif(1000)<br>
x6 &lt;- runif(1000)<br>
x7 &lt;- runif(1000)<br>
x8 &lt;- runif(1000)<br>
y &lt;- rnorm(1000)<br>
fit &lt;- lm(y~(x1*x2*x3*x4*x5*x6*x7*x8)^2)<br>
<br>
<br>
Uwe Ligges<br>
</tt></font>
<br><FONT SIZE=3><BR>
<BR>
                                NOTICE<BR>
               Please immediately e-mail back to sender <BR>
               if you are not the intended recipient. <BR>
<BR>
               Thereafter delete the e-mail along with <BR>
               any attachments without making copies. <BR>
<BR>
               Elkem reserves all rights of privilege, <BR>
               confidentiality and copyright.<BR>
</FONT>

--=_alternative 004613C000257091_=--



More information about the R-devel mailing list