StdDev

Return standard deviation of data

Declaration

Source position: math.pp line 518

  function StdDev(const data: Array of Single) : Float;
  function StdDev(const data: PSingle; const N: Integer) : Float;
  function StdDev(const data: Array of Double) : Float;
  function StdDev(const data: PDouble; const N: Integer) : Float;
  function StdDev(const data: Array of Extended) : Float;
  function StdDev(const data: PExtended; const N: Integer) : Float;

Description

Stddev returns the standard deviation of the values in Data. It returns zero if there is only one value.

The second form of the function accepts a pointer to an array of N values.

Errors

None.

See also

Name Description
mean Return mean value of array
meanandstddev Return mean and standard deviation of array
totalvariance Return total variance of values
variance Return variance of values

Example

Program Example40;
{ Program to demonstrate the stddev function. }
{ @ should return typed pointer }
{$T+}
Uses Math;
Var
  I : Integer;
  ExArray : Array[1..10000] of Float;
begin
  Randomize;
  for I:=low(ExArray) to high(ExArray) do
    ExArray[i]:=Randg(1,0.2);
  Writeln('StdDev     : ',StdDev(ExArray):8:4);
  Writeln('StdDev (b) : ',StdDev(@ExArray[1],10000):8:4);
end.