0

How do I calculate the standard error of the mean in MS Access? Here is what I have in mind:

SELECT 
Avg(qryAvgGROP.PctGROP_MCAR) AS AvgAvgGROP_MCAR 
StandardError(qryAvgGROP.PctGROP_MCAR) AS SemAvgGROP_MCAR
FROM qryAvgGROP;

In this example, qryAvgGROP returns a group of averages, which are again averaged in the code above. I therefore need the standard error of the mean, and NOT the standard deviation, so I cannot use the StDev() function.

CodeMed
  • 9,527
  • 70
  • 212
  • 364

1 Answers1

-1

Ok. Well here is a VBA function to calculate the Standard Deviation. As you are aware of the difference in equations perhaps you can edit this one to suit your needs. If you do not know how to use your own VBA functions in access there are plenty of resources out there or i'd be happy to help.

Function StdDev(k As Long, Arr() As Single)
 Dim i As Integer 
 Dim avg As Single, SumSq As Single

 avg = Mean(k, Arr) 
 For i = 1 To k 
      SumSq = SumSq + (Arr(i) - avg) ^ 2 
 Next i

 StdDev = Sqr(SumSq / (k - 1))

End Function

ant_iw3r
  • 222
  • 1
  • 2
  • 10
  • StDev is the wrong statistic for this situation. The standard error of the mean is required. If you are curious about the statistics, take an upper division statistics class, or read this link: http://en.wikipedia.org/wiki/Standard_error#Standard_error_of_mean_versus_standard_deviation – CodeMed Mar 05 '14 at 01:53
  • Edited to something that may be helpful. – ant_iw3r Mar 05 '14 at 17:44