function ZTest(const Data: TVec; const Mean: Double; const Sigma: Double; out hRes: THypothesisResult; out Signif: Double; var ConfInt: TDoubleArray; const hType: THypothesisType; const Alpha: Double): Double;
Z Test.
| # | Name | Description |
|---|---|---|
| 1 | Data | The data samples to be analyzed. |
| 2 | Sigma | The standard deviation to compare the data to. |
| 3 | Mean | The mean to value to compare the data to. |
| 4 | hRes | Returns the result of the null hypothesis (default assumption is that the means are equal). |
| 5 | hType | Defines the type of the null hypothesis (left, right and two - tailed). |
| 6 | Signif | (Significance level) returns the probability of observing the given result by chance given that the null hypothesis is true. |
| 7 | ConfInt | Returns the 100*(1-Alpha) percent confidence interval for the mean. |
| 8 | Alpha | Defines the desired significance level. If the significance probability (Signif) is bellow the desired significance (Alpha), the null hypothesis is rejected. |
Returns: Double - Z statistics.
Remarks:
Compares the normally distributed Data elements mean value with known standard deviation Sigma, to a mean value Mean.
Examples
Uses MtxExpr, Math387, Statistics;
procedure Example;
var d: Vector;
Signif : double;
HypRes : THypothesisResult;
MeanCI : TTwoElmReal;
begin
d.SetIt(false,[3,3.5,2,3.1,10,9]);
ZTest(d, 5, 1.29, HypRes, Signif, MeanCI);
// Signif = 0.84940087229; HypRes = hrNotReject;
// MeanCI=[4.06780398958, 6.13219601041]
// Comment : Since the SignRes is greater than Alpha (0.05), the
// null hypothesis (H0) that data mean is equal to 5.1 cannot be rejected
// the alternative (Ha) that data mean are NOT equal can therefore be
// rejected
end;
See Also: Statistics.tTest