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

2005-10-05 Thread hallgeir . grinde
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.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


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

2005-10-05 Thread Hallgeir . Grinde
R closes down while running the code described below.
How i can get it to crash on your PC, i do not know...

-Hallgeir Grinde



>
> 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?

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595



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 HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


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

2005-10-05 Thread Hallgeir . Grinde
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 <[EMAIL PROTECTED]>
05.10.2005 12:13
 
Til:Prof Brian Ripley <[EMAIL PROTECTED]>
cc: [EMAIL PROTECTED], [EMAIL PROTECTED]
Emne:   Re: [Rd] R crashes for large formulas in lm() (PR#8180)


Prof Brian Ripley wrote:

> On Wed, 5 Oct 2005 [EMAIL PROTECTED] 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"


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 <[EMAIL 
PROTECTED]>
05.10.2005 12:13
        
        Til:
       Prof Brian Ripley <[EMAIL PROTECTED]>
        cc:
       [EMAIL PROTECTED], [EMAIL PROTECTED]
        Emne:
       Re: [Rd] R crashes for large formulas
in lm() (PR#8180)


Prof Brian Ripley wrote:

> On Wed, 5 Oct 2005 [EMAIL PROTECTED] 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

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

2005-10-05 Thread Hallgeir . Grinde
Dette er en melding med flere deler i MIME-format.
--=_alternative 004C4E4A00257091_=
Content-Type: text/plain; charset="US-ASCII"

Yes.
so (x1*x2*x3*x4*x5*x6*x7*x8)^2 = (x1+x2+x3+x4+x5+x6+x7+x8)^8 ?
and there is a difference in
(x1*x2*x3*x4*x5*x6*x7*x8)^2
and
(x1*x2*x3*x4*x5*x6*x7*x8)
althoug the resulting formulas are the same, or?

This fikses my problem, but R still crashes for the large formula. It may 
be due to stack owerflow, but i guess this can be altered maually?







Prof Brian Ripley <[EMAIL PROTECTED]>
05.10.2005 12:50
 
Til:[EMAIL PROTECTED]
cc: Uwe Ligges <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED]
Emne:   Re: Ad: Re: [Rd] R crashes for large formulas in lm() 
(PR#8180)


On Wed, 5 Oct 2005 [EMAIL PROTECTED] wrote:

> 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 is not the same formula at all.  Try

> terms(y~(x1*x2*x3*x4*x5*x6*x7*x8)^2, simplify=TRUE)
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 + x1:x2:x3 + x1:x2:x4 + x1:x3:x4 + x1:x2:x5 + x1:x3:x5 +
...
 x1:x3:x4:x5:x6:x7:x8 + x2:x3:x4:x5:x6:x7:x8 + x1:x2:x3:x4:x5:x6:x7:x8

Did you actually want lm(y~(x1+x2+x3+x4+x5+x6+x7+x8)^2) ?

>
>
>
>
>
> Uwe Ligges <[EMAIL PROTECTED]>
> 05.10.2005 12:13
>
>Til:Prof Brian Ripley <[EMAIL PROTECTED]>
>cc: [EMAIL PROTECTED], [EMAIL PROTECTED]
>    Emne:   Re: [Rd] R crashes for large formulas in lm() (PR#8180)
>
>
> Prof Brian Ripley wrote:
>
>> On Wed, 5 Oct 2005 [EMAIL PROTECTED] 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.
>
>

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595


--=_alternative 004C4E4A00257091_=
Content-Type: text/html; charset="US-ASCII"


Yes.
so (x1*x2*x3*x4*x5*x6*x7*x8)^2
= (x1+x2+x3+x4+x5+x6+x7+x8)^8 ?
and there is a difference in
(x1*x2*x3*x4*x5*x6*x7*x8)^2
and
(x1*x2*x3*x4*x5