SampleSize function
Prototype: |
function SampleSize (const RelativePrecision :extended; const SampleVariance :extended; const Mean :extended; const StudentLevel :integer) : integer; |
|
Description: |
Calculates the minimum number of observations to include in a sample to achieve specified alpha of Student distribution. |
|
Syntax: |
variable := SampleSize (RelativePrecision, SampleVarince, Mean, StudentLevel); |
|
Part |
Description |
|
variable |
A variable declared as integer |
|
RelativePrecision |
Number from <0;1> interval indicating relative precision of estimate |
|
SampleVariance |
Sample variance |
|
Mean |
Mean |
|
Alpha |
Confidence level |
|
Return value: |
Minimal number of samples to achieve specified alpha |
|
Definition: |
[(Quantile of Students distribution ^ 2) * Variance]/ [(RelativePrecision * Mean) ^ 2] |
|
Example:
Task:
Calculate sample size of DBH.

Data stored in the database.
Script:
var
tab : TTableWrapper;
attributeName: string;
nullAsZero: boolean;
sv, m, s: extended;
begin
tab:= Trees.table;
attributeName:= 'DBH_mm';
nullAsZero:= false; // dont want calculate with a null value
sv:= SampleVariance(tab, attributeName, nullAsZero);
m:= Mean(tab, attributeName, nullAsZero);
s:= SampleSize(0.01, sv, m, 5);
ShowMessage(FloatToStr(s));
end.
Output in Field-Map Data Collector:

sample size of DBH
See also:
Mean; QuadraticMean; WeightedMean; Median; SampleVariance; StandardDeviation; StandardError; MeanError;VarianceOfMean; WeightedSampleVariance; WeightedStandardDeviation; WeightedVarianceOfMean;ConfidenceIntervalOfMean; VarianceOfTotal; ConfidenceIntervalOfTotal; StratifiedConfidenceIntervalOfTotal; SampleSize;ShowDistributionChart; ParameterizeRegressionModel; CalculateModelValue
© 2024 IFER-Monitoring and Mapping Solutions