Key note that this takes into account 'bias'. Bias is basically defined to be used to determine
whether the input set is complete or a sampling, and has to do with the accuracy of the information.
If the input set is a complete list of values (a popluation), set Bias = 0. If it is a sample from a
larger set, set it to Bias = 1.
;* ************************************************************ ;* FUNCTION STDDEV ( Values, Bias ) ;* Values - DynArray of values to use ;* Bias - value determining if this is a ;* sampling, or full set ;* ;* - Calculates standard deviation from a set ;* of values. Returns the standard deviation ;* ;* Written by Dave Meeks, February 2004 ;* ************************************************************ FUNCTION STDDEV( Values, Bias )
;* Error checking, just assure we have either 0 or 1 IF Bias NE 0 THEN Bias = 1 END
;* Get sum and mean NumValues = DCOUNT( Values, @FM ) SumValues = SUM( Values ) Mean = SumValues/NumValues Variance = 0
;* get variance FOR I = 1 TO NumValues Variance = Variance + PWR(Values<I>-Mean,2) NEXT I
;* get standard deviation StdDev = SQRT( Variance / ( NumValues - Bias ) ) RETURN( StdDev ) END
At 08:35 AM 2/9/2004 -0500, you wrote:
Is there a Universe Basic command to calculate standard deviation? If not, does anyone have a sub?
======================================================================== David T. Meeks || "All my life I'm taken by surprise Architect, Technology Office || I'm someone's waste of time Ascential Software || Now I walk a balanced line [EMAIL PROTECTED] || and step into tomorrow" - IQ ======================================================================== -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users