Field-Map Scripting

4.1.3.2.5 SampleVariance

SampleVariance function


Prototype:

function SampleVariance  (TableOrLayer :TObjectWrapper; const AttributeName :string; const NullAsZero :boolean) : extended;

Description:

Calculates variance of a specific attribute

Syntax:

variable := SampleVariance (tab, AttributeName, NullAsZero);


Part

Description


variable

A variable declared as type of extended


tab

Table containing source variables


AttributeName

Attribute of source table containing data to enter calculations


NullAsZero

Boolean expression defining whether to exclude null (false) entries or replace nulls with zeros (true)




Return value:

Variance



Example:


Task:

Calculate variance of DBH.


Data stored in the database.



Script:

var

 tab : TTableWrapper;

 attributeName: string;

 nullAsZero: boolean;

 x: extended;


begin

 tab:= Trees.table;

 attributeName:= 'DBH_mm';

 nullAsZero:= false;                    // dont want calculate with a null value


 x:= SampleVariance(tab, attributeName, nullAsZero);


 ShowMessage(FloatToStr(x));

end.


Output in Field-Map Data Collector:

variance of DBH


See also:

Mean; QuadraticMean; WeightedMean; Median; SampleVariance; StandardDeviation; StandardError; MeanError;VarianceOfMean; WeightedSampleVariance; WeightedStandardDeviation; WeightedVarianceOfMean;ConfidenceIntervalOfMean; VarianceOfTotal; ConfidenceIntervalOfTotal; StratifiedConfidenceIntervalOfTotal; SampleSize;ShowDistributionChart; ParameterizeRegressionModel; CalculateModelValue


Example