Skip to content

lm(rnorm(1000)~rnorm(1000)) kills rw1000 (PR#476)

6 messages · Charles C. Berry, Brian Ripley, Thomas Lumley +1 more

#
First:

	R core: (Thank You!)^HUGE_VAL

Now, down to business:

In a loop or in repeated command lines:

system.time(lm(rnorm(1000)~rnorm(1000)))

( or lm(rnorm(1000)~rnorm(1000))$coef )

fails after several iterations with the Windows message 'This program
has performed an illegal operation and will be shut down. If the
problem persists, please contact the vendor'.

clicking on DETAILS reveals:

RGUI caused an invalid page fault in
module R.DLL at 0137:100e938a.
Registers:
EAX=02dd9918 CS=0137 EIP=100e938a EFLGS=00010283
EBX=02bb9b18 SS=013f ESP=0253d4c0 EBP=0253e578
ECX=02bb9b2c DS=013f ESI=02dd9848 FS=3ebf
EDX=00000001 ES=013f EDI=0010a1ba GS=0000
Bytes at CS:EIP:
89 14 b8 8b 8d e8 ef ff ff 8b 9d c0 ef ff ff 47 
Stack dump:
00000000 02bb9cbc 02559278 1002fb4f 51eb851f 02bbac20 02bbac20 1002fb77 00000001 00000001 72707865 69737365 00000001 0262d9c4 8038456c 17f70bef 


Likewise with Rterm.

This also happens on rw0990.

My office setup is a trifle unusual - it is a SUNPCi board (actually
an AMDK6) that fits in an Ultra 10. Some of the Windows drivers are
replaced by Sun versions that allow access to system services on the
UltraSparc. There are bugs in this setup, but on the whole it seems
fairly stable when using applications like SAS and Office.

It does not happen on rw0901 or rw0651 (? version number ?) on my HOME
PC. Nor on R 0.90.1 under Solaris

Enclosing EITHER 'rnorm(1000)' within I( ) seems to cure this
behavior. (It also produces the behavior I expected, viz. regressing
one set of random normal deviates on another. FWIW, neither Splus3.4
for Solaris nor R 0.90.1 produce the result I expected unless I() is
used.)

Chuck Berry

--please do not edit the information below--

Version:
 platform = Windows
 arch = x86
 os = Win32
 system = x86, Win32
 status = 
 major = 1
 minor = 0.0
 year = 2000
 month = February
 day = 29
 language = R

Windows 9x 4.0 (build 1111)  B

Search Path:
 .GlobalEnv, Autoloads, package:base
#
On Tue, 7 Mar 2000 cberry@tajo.ucsd.edu wrote:

            
It does happen on R 1.0.0 on Solaris and on rw1000 on a real PC.
#
On Tue, 7 Mar 2000, Prof Brian D Ripley wrote:

            
Something strange is happening where we ensure that the response does not
appear on the rhs of the formula.  

At lines 1643ff of model.c we count how many columns of the design matrix
are needed for each model term.  This count is not done if the term is the
response, which leaves the count uninitialised.

We then use this uninitialised count at 1673ff to construct the assign
attribute.

	-thomas



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Tue, 7 Mar 2000, Thomas Lumley wrote:

            
Incidentally, this command doesn't do what the user probably thinks it
does:  lm thinks that the rnorm(1000) on the lhs is the same as the one on
the rhs and drops it from the model, fitting only an intercept.

I think this is unavoidable, since model.matrix can't be expected to know
whether an arbitrary function is deterministic or random.

The work-around is
	a<-rnorm(1000)
	b<-rnorm(1000)
	lm(a~b)


	-thomas


Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
A patch is

1649,1652c1649
<       if (j == rhs_response) {
<           INTEGER(count)[j]=0;  /* need this initialised */
<           continue;
<       }
---
-thomas

Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Thomas Lumley <thomas@biostat.washington.edu> writes:
Hmm, this wouldn't happen to cure the update(.~.-whateveritwas) case
by jfox, would it? (darn nasty one that one...)