There's no compiler errors or anything. It's just my standard deviation doesn't match with the expectation of standard deviation.
With this program, I get 2.872281323690143 while it is supposed to be 3.0276503540974917. I'm not sure if it is part of my calculation problem or I forget to add something to the program?
(Any real statisticians out there, it's okay if you're still laughing at me.)
 1
Paul Clapham wrote:I'm no statistician, but I sort of recall that there's two kinds of standard deviation, one of them involves dividing by N and the other involves dividing by N1. The latter would produce a larger result but you've used the former, so perhaps that's the source of your discrepancy.
(Any real statisticians out there, it's okay if you're still laughing at me.)
Oh right. I solved the issue. Thanks for reminding me about that there's two kinds of standard deviation. :)
Paul Clapham wrote:I'm no statistician, but I sort of recall that there's two kinds of standard deviation, one of them involves dividing by N and the other involves dividing by N1. The latter would produce a larger result but you've used the former, so perhaps that's the source of your discrepancy.
It's been a few geological epochs for me, but I seem to remember you use n1 for sample variances (and therefore SD's). I'm sure Piet'll enlighten us if he's around.
Winston
"Leadership is nature's way of removing morons from the productive flow"  Dogbert
Articles by Winston can be found here
Tim Moores wrote:You might also consider using the BigDecimal class instead of doubles, depending on how much accuracy is desired. It's not going to make much difference for 10 elements, but for much larger datasets, the floating point inaccuracies will eventually add up to noticeable amounts.
Hmmm. Maybe, but since SD is a value in the same unit as the input, and the variance sum is divided by n (or n1) anyway (and (x  x̄) reduces the likelihood of inaccuracy due to the magnitude of the values), I doubt it'll make too much difference as long as you don't assume that the value is accurate to more than a few decimal places.
Winston
It will give me the powers of the gods. Not bad for a tiny ad:
The WEB SERVICES and JAXRS Course
https://coderanch.com/t/690789/WEBSERVICESJAXRS
