Performs a z-test to test whether the given sample is compatible with the given normal reference population.
Namespace:
Meta.Numerics.Statistics
Assembly:
Meta.Numerics (in Meta.Numerics.dll) Version: 4.1.4
Syntax public static TestResult ZTest(
this IReadOnlyCollection<double> sample,
double referenceMean,
double referenceStandardDeviation
)
<ExtensionAttribute>
Public Shared Function ZTest (
sample As IReadOnlyCollection(Of Double),
referenceMean As Double,
referenceStandardDeviation As Double
) As TestResult
public:
[ExtensionAttribute]
static TestResult^ ZTest(
IReadOnlyCollection<double>^ sample,
double referenceMean,
double referenceStandardDeviation
)
[<ExtensionAttribute>]
static member ZTest :
sample : IReadOnlyCollection<float> *
referenceMean : float *
referenceStandardDeviation : float -> TestResult
Parameters
- sample
- Type: System.Collections.GenericIReadOnlyCollectionDouble
The sample. - referenceMean
- Type: SystemDouble
The mean of the reference population. - referenceStandardDeviation
- Type: SystemDouble
The standard deviation of the reference population.
Return Value
Type:
TestResultA test result indicating whether the sample mean is compatible with that of the given reference population.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IReadOnlyCollectionDouble. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Exceptions Remarks A z-test determines whether the sample is compatible with a normal population with known mean and standard deviation.
In most cases, Student's t-test (StudentTTest(IReadOnlyCollectionDouble, Double)), which does not assume a known population standard deviation,
is more appropriate.
Examples Suppose a standardized test exists, for which it is known that the mean score is 100 and the standard deviation is 15
across the entire population. The test is administered to a small sample of a subpopulation, who obtain a mean sample score of 95.
You can use the z-test to determine how likely it is that the subpopulation mean really is lower than the population mean,
that is that their slightly lower mean score in your sample is not merely a fluke.
See Also