JackSkellington
Technical User
I have the current code calculating STDEV but there seems to be a problem because the anwer returned is incorrect, any idea's why?
Code:
Sub Main()
Dim idx As Integer = 0
Dim Sumsq As Double = 0
Dim Score As Double = 0
Dim sq As Double = 0
Dim theCount As Integer = 4
Dim arrValue As Int32() = {(5), (6), (8), (9)}
Dim theMean As Integer = 7
Dim sqr As Double = 0
If Not arrValue Is Nothing Then
If theCount > 0 Then
For idx = 0 To theCount - 1
Score = arrValue(idx) - theMean
sq = Math.Pow(Score, 2)
Sumsq = Sumsq + sq
Next
End If
Sumsq = Sumsq / (theCount - 1)
sqr = Math.Abs(Math.Sqrt(Sumsq))
' should get 1.5811388300841898
End If