return the standard deviation
| 57 | |
| 58 | // return the standard deviation |
| 59 | double KeyListOpsMethods::getStddev() { |
| 60 | if (empty()) return NAN; |
| 61 | |
| 62 | double avg = getMean(); |
| 63 | double squareDiffSum = 0.0; |
| 64 | for (begin(); !end(); next()) { |
| 65 | double val = getColValNum(); |
| 66 | double diff = val - avg; |
| 67 | squareDiffSum += diff * diff; |
| 68 | } |
| 69 | return sqrt(squareDiffSum / (float)getCount()); |
| 70 | } |
| 71 | // return the standard deviation |
| 72 | double KeyListOpsMethods::getSampleStddev() { |
| 73 | if (empty()) return NAN; |