Skip to content
Prev 167652 / 398502 Next

inconsistent lm results with fixed response variable

Oh for Pete's sake!

Computers use floating point arithmetic.  Your residual standard  
error in
case 2 (i.e. 1.44e-14) *is* 0, but floating point arithmetic can't  
quite see
that this is so. Put in a check for the RSE being 0, and ``over- 
ride'' the
adjusted R squared to be NA (or NaN, or whatever floats your boat) in  
such instances.
The all.equal() function might be useful to you:

 > x <- 1.44e-14
 > all.equal(x,0)
[1] TRUE

(Caution:  Trap for Young Players:  If x and y are ``really'' different,
then all.equal(x,y) doesn't return FALSE as you might expect, but rather
a description of the difference between x and y --- which may be  
complicated
if x and y are complicated objects.  The function isTRUE() is useful  
here.)

	cheers,

		Rolf Turner
On 21/01/2009, at 9:21 AM, tyler wrote:

            
######################################################################
Attention: 
This e-mail message is privileged and confidential. If you are not the 
intended recipient please delete the message and notify the sender. 
Any views or opinions presented are solely those of the author.

This e-mail has been scanned and cleared by MailMarshal 
www.marshalsoftware.com
######################################################################