[R] R hang-up using lm

Göran Broström gb at stat.umu.se
Wed Apr 28 11:18:38 CEST 2004


On Wed, Apr 28, 2004 at 11:46:51AM +0300, Renaud Lancelot wrote:
> Martin Maechler a écrit :
> >>>>>>"kjetil" == kjetil  <kjetil at acelerate.com>
> >>>>>>   on Tue, 27 Apr 2004 19:19:59 -0400 writes:
> >
> >
> >    kjetil> On 27 Apr 2004 at 16:46, Raubertas, Richard wrote:
> >    >> Within the last few weeks, someone else reported a similar
> >    >> problem when using the results of tapply in a call to rlm().
> >    >> Note that the result of tapply is a 1D array, and it appears
> >    >> there is a general problem with using such a thing on the
> >    >> RHS in formula-based modeling functions:
> >    >> 
> >    >> set.seed(3)
> >    >> yy <- rnorm(20)
> >    >> gg <- rep(1:10, 2)
> >    >> y <- tapply(yy, gg, median)
> >    >> x <- 1:10
> >    >> z <- lm(y ~ x)  # OK
> >    >> z <- lm(x ~ y)  # crashes R
> >    >> 
> >    >> (R 1.8.1 on Windows XP Pro)
> >    >> 
> >
> >    kjetil> What exactly do you mean by "crashes R"
> >
> >    kjetil> Doing this in R1.9.0, windows XP pro, there is no indication 
> >    of kjetil> problems.
> >
> >nor is there with 1.9.0 or R-patched on Linux,
> >nor with R 1.8.1 on Linux.
> >
> >no warning, no error, no problem at all.
> >Is it really the above (reproducible, thank you!) example
> >that crashes your R 1.8.1 ?
> 
> It does it for me: Windows XP Pro, R 1.9.0 (P IV, 2.4 GHz, 256 Mo RAM). 
> It freezes RGui and a few seconds later, a Windows message appears 
> saying that Rgui front-end met a problem and must be closed.

I had to try it too: No crashes on Win2000 pro (1.8.1) or Linux (1.9.0),
but (in both cases):


>  lm(y ~ x)

Call:
lm(formula = y ~ x)

Coefficients:
(Intercept)            x  
    -0.8783       0.1293  


>  lm(x ~ y)

Call:
lm(formula = x ~ y)

Coefficients:
(Intercept)  
        5.5  

i.e., only an intercept estimate in the second case! Surely something is
wrong!? 

Göran


> 
> Best,
> 
> Renaud
> 
> -- 
> Dr Renaud Lancelot
> vétérinaire épidémiologiste
> Ambassade de France - SCAC
> BP 834 Antananarivo 101
> Madagascar
> 
> tél. +261 (0)32 04 824 55 (cell)
>      +261 (0)20 22 494 37 (home)
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html

-- 
 Göran Broström                    tel: +46 90 786 5223
 Department of Statistics          fax: +46 90 786 6614
 Umeå University                   http://www.stat.umu.se/egna/gb/
 SE-90187 Umeå, Sweden             e-mail: gb at stat.umu.se




More information about the R-help mailing list