I am trying to calculate the standard deviation of a given set of numbers.
If i use excel and the STDEV function i get 1.58113883
which is all good. But if i go to http://invsee.asu.edu/srinivas/stdev.html and enter the same numbers I get 1.4142135623730951
Now the the problem i have is in a vb.net program I have written a function that returns the latter of the two numbers. Which i believe is wrong.
1. Which number is correct?
2. If anyone knows vb.net is the below code correct? This returns the second value of the two.
Public Function standard deviation(ByVal Inputdata() As Double) As Double
Dim DataAverage As Double = 0
Dim TotalVariance As Double = 0
DataAverage = SMA(Inputdata)'get our moving average value
For i = 0 To Inputdata.Length - 1
TotalVariance = (TotalVariance + Math.Pow((Inputdata(i) - DataAverage), 2))
StandardDeviation = Math.Sqrt(TotalVariance / Inputdata.Length))
Any ideas? Or pointers.