Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Standard deviation with True/False data

I read various data from a PLC and use Measurement Studio controls to do graphing, charting and calculations. I use the CWStat1.StdDev function to do my required statistics. Some of the data I gather is True/False. I am unsure how to calculate Standard Deviation on True/False data. Any suggestions are greatly appreciated.
 
Thanks,
Bob Hiller
0 Kudos
Message 1 of 5
(18,275 Views)
Hi Bob,

In the most technical sense, you should be able to calculate the Standard Deviation of a set of True / False data by converting the Trues to 1's and the Falses to 0's.

However, I am used to thinking of the standard deviation of a data set as how "spread out" your data is. To compute the standard deviation of a set of data consisting of only 1's and 0's will always give you a decimal value between 0 and 1. Could you explain a little more what you'd like to find out about your True / False data?

Thanks Bob, have a good one!

Dan Weiland
Applications Engineer
National Instruments
Dan Weiland
0 Kudos
Message 2 of 5
(18,255 Views)

Dan,

I understand that the values will be represented between 0 and 1. My customer asked for Standard Deviation on all test functions. I think that True/False data is better represented as a percentage of Pass and Fail. I don't think is statistically relevant using Standard Deviation. My customer has now let me determine the best case for True/False statistical representation. What other options are available using NI functions and control?

Thanks,

Bob Hiller

0 Kudos
Message 3 of 5
(18,250 Views)
There isn't anything that specifically addresses your needs in Measurement Studio Bob, however a couple of options come to mind.

If you want to calculate the percentage of True values in an array where 1 is True and 0 is false, and you are using the CWArray control, you could use the SumArray method and the ArrayDims method to divide the number of 1's by the total length of the array and multiply by 100 to find the percentage of True values.

Similarly, you could use the SearchArray function which will return an array with the indices of your search value, and divide that array length by the original Boolean array length to come to the same results.

Hope this helps Bob,

Dan Weiland
Applications Engineer
National Instruments
Dan Weiland
0 Kudos
Message 4 of 5
(18,237 Views)

You could simply treat the data as comming from a binomial distribution (BD). The BD is used when dealing with attribute data, such as pass/fail, true/false etc.

The formula for SD when dealing with the BD is

SD=(P(1-P)/N)^0.5

where P is the average probability, N is the sample size

Example, you 'record' 500 readings of which 75 of them are 'Fail'. P=75/500=0.15, N=500, therefore SD=(0.15*(1-0.15)/500)^0.5

SD=0.015969.

This is a mathematically correct calculation for the SD of the population that 'failed'

 

0 Kudos
Message 5 of 5
(18,216 Views)