09-27-2010 05:00 PM
There is an error in the standard deviation calculation!!!!
Dim numArray() as Double = {19.14, 31.14, 28.14}
Dim
dStdev As Double = NationalInstruments.Analysis.Math.Statistics.StandardDeviation(numArray)
dStdev = 5.0990195135927845
Actual standard deviation: 6.244998
Version 8.9.20.246
09-28-2010 11:04 AM
Hi Steverino,
I am not sure how you are calculating your standard deviation, but this might be where we are running into a difference. The Measurement Studio help specifies that we calculate the population standard deviation. To calculate the sample standard deviation you should refer to the Measurement Studio help on the method and follow the instructions to do so.
Thanks
09-28-2010 11:17 AM
Hi Steve,
I'm assuming your using Excel to calculate standard deviation
The STDEV formula gives 6.244 as an answer.
The STDEVP formula gives 5.09902 as an answer
STDEVP uses the following formula:

where x is the sample mean AVERAGE(number1,number2,…) and n is the sample size.

where x is the sample mean AVERAGE(number1,number2,…) and n is the sample size.
Curt
09-28-2010 11:22 AM
Also,
Both formulas return the same value for larger population sizes.
I could be wrong but I think you should to have a population of around 36 or higher to calculate any meaningful standard deviation data
Curt
09-28-2010 02:42 PM
Thanks, for the information. I should have checked for the population standard deviation. Actually, I used my TI-36X calculator to calculate the standard deviation "s".
The one to use (sample vs population) actually has nothing to do with the number of data points. The determining factor is this: Are we dealing with the population or a subset (sample) of the population? In most cases we are dealing with subsets of the population, and therefore the sample standard deviation is the correct formula. As the sample size gets larger, the difference between the two gets smaller. After a sample size of thirty or so they are virtually the same.
For example, if we wanted to measure the standard deviation in weight of every male in the US we could report the population standard deviation only if we actually measured the weight of every male in the US. Practically speaking we would be taking only a small subset of all males and therefore we are reporting the sample standard deviation.
Ryan, in response to your comments, the NI documentation is poor on this topic. Aside from the syntax descriptions, the entire description of the function in the online help for the Analysis.Math namespace is this: "Computes the standard deviation of the values in the input array." No mention of sample vs population calculations.
IMHO, the only thing NI does poorly is documentation.
09-29-2010 08:37 AM
Hi Steverino,
When searching the Measurement Studio help the Local Help will return the most usefull information. If search for standarddeviation the first hit that returns is Statistics.StandardDeviation Method. If we open the help on this topic it goes over a lot of information on the function. If you take a look at the Remarks section this is where you will find the information that you are searching for.
Thanks