home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / bit / listserv / statl / 2335 < prev    next >
Encoding:
Text File  |  1993-01-08  |  4.6 KB  |  97 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!spool.mu.edu!wupost!howland.reston.ans.net!paladin.american.edu!auvm!CBIS.ECE.DREXEL.EDU!CHARLES.HAAS
  3. Message-ID: <9301081401.AA01015@cbis.ECE.Drexel.EDU>
  4. Newsgroups: bit.listserv.stat-l
  5. Date:         Fri, 8 Jan 1993 09:06:51 -1000
  6. Sender:       STATISTICAL CONSULTING <STAT-L@MCGILL1.BITNET>
  7. Comments:     Warning -- original Sender: tag was chaas@CBIS.ECE.DREXEL.EDU
  8. From:         Charles Haas <Charles.Haas@CBIS.ECE.DREXEL.EDU>
  9. Subject:      Roundoff of various formulae in spreadsheets
  10. Lines: 85
  11.  
  12. There has been some discussion of late on the relative numerical precision
  13. of various algorithms, including a discussion of the "unreliability" of
  14. built-in spreadsheet functions at computing routine statistical tests.  I
  15. decided to perform a simple numerical experiment, using Excel version 3.0
  16. for the Macintosh (on a IIci).
  17.  
  18. Consider the data set comprised of three points: (x, x+e, x-e).  I set x to
  19. 1E20 and looked at the standard deviation (using the builtin STDEV
  20. function) versus various values of e.  I also used the "mean shift" method
  21. of computing the standard deviation, i.e.
  22.  
  23. s = sqrt((sum(xi-xmean)^2)/(N-1))
  24.  
  25. The exact result should yield a standard deviation equal to "e".
  26.  
  27. The following is the result:
  28.  
  29. e               excel stdev                     stdev(mean shift)
  30. 1.00E+13        9.9565E+12                      1E+13
  31. 5E+12             4.9172E+12    (2% err)     5E+12
  32. 2E+12             1.5549E+12   (22 % err)   2E+12
  33. 1E+12             0                                        1E+12
  34. 5E+11            0                                         5E+11
  35. 2E+11            0                                         2E+11
  36. 1E+11            0                                        1E+11
  37. 5E+10            0                                        5E+10
  38. 2E+10            0                                        2E+10
  39. 1E+10            0                                       1E+10
  40. 5000000000      0                           5000003584
  41. 2000000000      0                           1999994880
  42. 1000000000      0                             999997440
  43. 500000000       0                              500006912
  44. 200000000       0                              199999488
  45. 100000000       0                              100007936
  46. 50000000        0                                 50003968
  47. 20000000        0                                 20004864
  48. 10000000        0                                   9994240
  49. 5000000 0                                            4997120
  50. 2000000 0                                            1998848
  51. 1000000 0                                              999424
  52. 500000  0                                               507904 (1 % err)
  53. 200000  0                                               196608  (2 % err)
  54. 100000  0                                                 98304
  55. 50000   0                                                  49152
  56. 20000   0                                                  16384 (15 % err)
  57. 10000   0                                                  16384  (60 % err)
  58. 5000            0                       0
  59.  
  60. Conclusions:
  61.  
  62. 1) The built-in Excel function should be suspect if the interquartile range
  63. (a robust scale estimator) is very small (particularly less than one part
  64. in one million) relative to the mean.
  65.  
  66. 2) The mean shift method (naive computation) is more reliable, down to
  67. about one part in 1E15.
  68.  
  69. Questions:
  70.  
  71. The computation is run on a machine with a FPU.  I wonder whether or not
  72. there might be a difference on a machine without an FPU.  Also, is the
  73. accuracy on other platforms (DOS) the same?
  74.  
  75. Comment:
  76.  
  77. The computing formula for the standard deviation is often justified (from
  78. the days of slide rules and machines in which memory limitations were
  79. severe, e.g. calculators) as simpler (being "one pass") compared to the
  80. defining equation for standard deviation.  However the above shows a clear
  81. and substantial (at least in applications at which the deviation is below
  82. the ppm relative range) difference in the methods.
  83.  
  84. {=== Perhaps I have just replowed old ground? =================}
  85.  
  86. /-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/ -/-/-/
  87. / Charles N. Haas                                                         /
  88. / Betz Professor of Environmental Engineering            /
  89. / Drexel University                                                        /
  90. / Philadelphia, PA 19104                                               /
  91.  
  92. /
  93.            /
  94. / Internet:       CHAAS@CoE.Drexel.Edu   (preferred)  /
  95. / Bitnet:          HAASCN@DUVM.BITNET                  /
  96. /-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/
  97.