forked from RobTillaart/Arduino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request RobTillaart#1 from RobTillaart/m1
+ version 0.3.2
Showing
5 changed files
with
85 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
FAQ ARDUINO STATISTICS LIB ARDUINO | ||
===================================== | ||
|
||
Q: Are individual samples still available? | ||
The values added to the library are not stored in the lib as it would use lots of memory quite fast. Instead a few calculated values are kept to be able to calculate the most important statistics. | ||
|
||
|
||
Q: How many samples can the lib hold? (internal variables and overflow) | ||
The counter of samples is a long, implying a maximum of 2Gig samples. In practice 'strange' things might happen before this number is reached. There are two internal variables, _sum which is the sum of the values and _ssq which is the sum of the squared values. Both can overflow especially _ssq will grow fast. The library does not protect against it. | ||
|
||
There is a workaround for this (to some extend) if one knows the approx average of the samples before. Before adding values to the lib subtract the expected average. The sum of the samples would move to around zero. This workaround has no influence on the standard deviation. !! Do not forget to add this expected average to the calculated average. (Q: could this be build into the lib?) | ||
|
||
|
||
Q: How about the precision of the library? | ||
The precision of the internal variables is restricted due to the fact that they are 32 bit float (IEEE754). If the internal variable _sum has a large value, adding relative small values to the dataset wouldn't change its value any more. Same is true for _ssq. One might argue that statistically speaking these values are less significant, but in fact it is wrong. | ||
There is a workaround for this (to some extend). If one has the samples in an array or on disk, one can sort the samples in increasing order (abs value) and add them from this sorted list. This will minimize the error, but it works only if the samples are available and the they may be added in the sorted order. | ||
|
||
|
||
Q: When will internal var's overflow? esp. squared sum | ||
IEEE754 floats have a max value of +- 3.4028235E+38. | ||
|
||
|
||
Q: Why are there two functions for stdev? | ||
There are two stdev functions the population stdev and the unbiased stdev. | ||
See Wikipedia for an elaborate description of the difference between these two. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
2012-05-19 | ||
------------- | ||
This is a simple statistics library for the Arduino, version: 0.3.1 | ||
previous versions are not available. | ||
|
||
2013-08-17 | ||
------------ | ||
version: 0.3.2 | ||
http://arduino.cc/playground/Main/Statistics | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 12 additions & 11 deletions
23
...es/Statistic/examples/Average/Average.pde → ...es/Statistic/examples/Average/Average.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters