Unit 'Math' Package
[Overview][Constants][Types][Classes][Procedures and functions][Index] [#rtl]

TotalVariance

Return total variance of values.

Declaration

Source position: math.pp line 737

function TotalVariance(

  const data: array of Single

):Float;

function TotalVariance(

  const data: PSingle;

  const N: Integer

):Float;

function TotalVariance(

  const data: array of Double

):Float;

function TotalVariance(

  const data: PDouble;

  const N: Integer

):Float;

function TotalVariance(

  const data: array of Extended

):Float;

function TotalVariance(

  const data: PExtended;

  const N: Integer

):Float;

Description

TotalVariance returns the total variance of the values in the data array. 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

variance

  

Return variance of values.

stddev

  

Return standard deviation of data.

mean

  

Return mean value of array.

Example

Program Example49;

{ Program to demonstrate the TotalVariance function. }
{ @ should return typed pointer }
{$T+}

Uses math;

Type
  TExArray = Array[1..100] of Float;

Var
  I : Integer;
  ExArray : TExArray;
  TV : float;

begin
  Randomize;
  or:=1 to 100 do
    ExArray[i]:=(Random-Random)*100;
  TV:=TotalVariance(ExArray);
  Writeln('Total variance     : ',TV:8:4);
  TV:=TotalVariance(@ExArray[1],100);
  Writeln('Total Variance (b) : ',TV:8:4);
end.

Documentation generated on: Dec 24 2024