[R] identical values not so identical? newbie help please!

2011-03-10 Thread maiya
Hi there! I'm not sure I can create a minimal example of my problem, so I'm linking to a minimal .RData file that has only two objects: obs and exp, each is a 6x9 matrix. http://dl.dropbox.com/u/10364753/test.RData link to dropbox file (I hope this is acceptable mailing list etiquette!) Here's

Re: [R] identical values not so identical? newbie help please!

2011-03-10 Thread Nordlund, Dan (DSHS/RDA)
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of maiya Sent: Thursday, March 10, 2011 7:19 AM To: r-help@r-project.org Subject: [R] identical values not so identical? newbie help please! Hi there! I'm not sure I can create

Re: [R] identical values not so identical? newbie help please!

2011-03-10 Thread Joshua Wiley
Hi Maja, Values that are theoretically the same may not be exactly identical when using floating point arithmetic. Please read this FAQ page: http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f If you need to test that they are equal, you may add a

Re: [R] identical values not so identical? newbie help please!

2011-03-10 Thread maiya
Thanks Josh and Dan! I did figure it had something to do with the machine epsilon... But so what do I do now? I'm calculating the total absolute error over thousands of tables e.g.: tae-sum(abs(obs-exp)) Is there any easy way to I keep these ignorable errors from showing up? And furthermore,

Re: [R] identical values not so identical? newbie help please!

2011-03-10 Thread Joshua Wiley
On Thu, Mar 10, 2011 at 10:34 AM, maiya maja.zaloz...@gmail.com wrote: Thanks Josh and Dan! I did figure it had something to do with the machine epsilon... But so what do I do now? I'm calculating the total absolute error over thousands of tables e.g.: tae-sum(abs(obs-exp)) Is there any

Re: [R] identical values not so identical? newbie help please!

2011-03-10 Thread David A. Johnston
The function all.equal also might be helpful. See the help page. help(all.equal) -David Johnston -- View this message in context: http://r.789695.n4.nabble.com/identical-values-not-so-identical-newbie-help-please-tp3346078p3346581.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] identical values not so identical? newbie help please!

2011-03-10 Thread Nordlund, Dan (DSHS/RDA)
- project.org] On Behalf Of maiya Sent: Thursday, March 10, 2011 10:34 AM To: r-help@r-project.org Subject: Re: [R] identical values not so identical? newbie help please! Thanks Josh and Dan! I did figure it had something to do with the machine epsilon... But so what do I do now? I'm

Re: [R] identical values not so identical? newbie help please!

2011-03-10 Thread Petr Savicky
On Thu, Mar 10, 2011 at 10:34:21AM -0800, maiya wrote: Thanks Josh and Dan! I did figure it had something to do with the machine epsilon... But so what do I do now? I'm calculating the total absolute error over thousands of tables e.g.: tae-sum(abs(obs-exp)) Is there any easy way to I

Re: [R] identical values not so identical? newbie help please!

2011-03-10 Thread maiya
Aaah, it truly is wonderful, this technology! I guess I'm going to have to override it a bit though.. Along the lines of tae - ifesle(all.equal(obs, exp) == TRUE, 0, sum(abs(obs - exp))) Do I like doing this? No. But short of reading the vast literature that exists on calculation precision -

Re: [R] identical values not so identical? newbie help please!

2011-03-10 Thread maiya
Quite fascinating, if annoying. Nice example Petr! Turns out my expected values are causing even more trouble because of this! I've even gotten negative chi square values (calculated using Cressie and Read's formula)! So instead of kludging the error measurement code, I think I'm going to have

Re: [R] identical values not so identical? newbie help please!

2011-03-10 Thread Berwin A Turlach
G'day Maja, On Thu, 10 Mar 2011 11:44:28 -0800 (PST) maiya maja.zaloz...@gmail.com wrote: Aaah, it truly is wonderful, this technology! I guess I'm going to have to override it a bit though.. Along the lines of tae - ifesle(all.equal(obs, exp) == TRUE, 0, sum(abs(obs - exp))) Please read