Standard Deviation

C

Charles Deng

Does anyone know the expression for calculating standard
deviation? Thanks a lot in advance.

Charles
 
J

JoeElla

This came right out of the Access help

This example uses the Orders table to estimate the standard deviation of the
freight charges for orders shipped to the United Kingdom.
This example calls the EnumFields procedure, which you can find in the
SELECT statement example.

Sub StDevX()

Dim dbs As Database, rst As Recordset

' Modify this line to include the path to Northwind
' on your computer.
Set dbs = OpenDatabase("Northwind.mdb")

' Calculate the standard deviation of the freight
' charges for orders shipped to the United Kingdom.
Set rst = dbs.OpenRecordset("SELECT " _
& "StDev(Freight) " _
& "AS [Freight Deviation] FROM Orders " _
& "WHERE ShipCountry = 'UK';")

' Populate the Recordset.

rst.MoveLast

' Call EnumFields to print the contents of the
' Recordset. Pass the Recordset object and desired
' field width.
EnumFields rst, 15

Debug.Print

Set rst = dbs.OpenRecordset("SELECT " _
& "StDevP(Freight) " _
& "AS [Freight DevP] FROM Orders " _
& "WHERE ShipCountry = 'UK';")

' Populate the Recordset.
rst.MoveLast

' Call EnumFields to print the contents of the
' Recordset. Pass the Recordset object and desired

' field width.
EnumFields rst, 15

dbs.Close

End Sub
 
G

Guest

Joe,

Thank you very much.


Charles

-----Original Message-----
This came right out of the Access help

This example uses the Orders table to estimate the standard deviation of the
freight charges for orders shipped to the United Kingdom.
This example calls the EnumFields procedure, which you can find in the
SELECT statement example.

Sub StDevX()

Dim dbs As Database, rst As Recordset

' Modify this line to include the path to Northwind
' on your computer.
Set dbs = OpenDatabase("Northwind.mdb")

' Calculate the standard deviation of the freight
' charges for orders shipped to the United Kingdom.
Set rst = dbs.OpenRecordset("SELECT " _
& "StDev(Freight) " _
& "AS [Freight Deviation] FROM Orders " _
& "WHERE ShipCountry = 'UK';")

' Populate the Recordset.

rst.MoveLast

' Call EnumFields to print the contents of the
' Recordset. Pass the Recordset object and desired
' field width.
EnumFields rst, 15

Debug.Print

Set rst = dbs.OpenRecordset("SELECT " _
& "StDevP(Freight) " _
& "AS [Freight DevP] FROM Orders " _
& "WHERE ShipCountry = 'UK';")

' Populate the Recordset.
rst.MoveLast

' Call EnumFields to print the contents of the
' Recordset. Pass the Recordset object and desired

' field width.
EnumFields rst, 15

dbs.Close

End Sub
Charles Deng wrote in message <02d501c39d8c$a120a7c0 [email protected]>...
Does anyone know the expression for calculating standard
deviation? Thanks a lot in advance.

Charles


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top