ZTest Class 
Namespace: Accord.Statistics.Testing
The ZTest type exposes the following members.
Name  Description  

ZTest 
Constructs a TTest.
 
ZTest(Double, OneSampleHypothesis) 
Constructs a Z test.
 
ZTest(Double, Double, OneSampleHypothesis) 
Constructs a Z test.
 
ZTest(Double, Double, Double, OneSampleHypothesis) 
Constructs a Z test.
 
ZTest(Double, Double, Int32, Double, OneSampleHypothesis) 
Constructs a Z test.

Name  Description  

Analysis 
Gets the power analysis for the test, if available.
 
Confidence 
Gets the 95% confidence interval for the EstimatedValue.
 
CriticalValue 
Gets the critical value for the current significance level.
(Inherited from HypothesisTestTDistribution.)  
EstimatedValue 
Gets the estimated value, such as the mean estimated from a sample.
 
Hypothesis 
Gets the alternative hypothesis under test. If the test is
Significant, the null hypothesis can be rejected
in favor of this alternative hypothesis.
 
HypothesizedValue 
Gets the hypothesized value.
 
PValue 
Gets the Pvalue associated with this test.
(Inherited from HypothesisTestTDistribution.)  
Significant 
Gets whether the null hypothesis should be rejected.
(Inherited from HypothesisTestTDistribution.)  
Size 
Gets the significance level for the
test. Default value is 0.05 (5%).
(Inherited from HypothesisTestTDistribution.)  
StandardError 
Gets the standard error of the estimated value.
 
Statistic 
Gets the test statistic.
(Inherited from HypothesisTestTDistribution.)  
StatisticDistribution 
Gets the distribution associated
with the test statistic.
(Inherited from HypothesisTestTDistribution.)  
Tail 
Gets the test type.
(Inherited from HypothesisTestTDistribution.) 
Name  Description  

Compute(Double, OneSampleHypothesis) 
Computes the Z test.
 
Compute(Double, Double, Double, OneSampleHypothesis) 
Computes the Z test.
 
Equals  Determines whether the specified object is equal to the current object. (Inherited from Object.)  
Finalize  Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)  
GetConfidenceInterval 
Gets a confidence interval for the EstimatedValue
statistic within the given confidence level percentage.
 
GetHashCode  Serves as the default hash function. (Inherited from Object.)  
GetType  Gets the Type of the current instance. (Inherited from Object.)  
MemberwiseClone  Creates a shallow copy of the current Object. (Inherited from Object.)  
OnSizeChanged  Update event. (Overrides HypothesisTestTDistributionOnSizeChanged.)  
PValueToStatistic(Double) 
Converts a given pvalue to a test statistic.
(Overrides HypothesisTestTDistributionPValueToStatistic(Double).)  
PValueToStatistic(Double, DistributionTail) 
Converts a given pvalue to a test statistic.
 
StatisticToPValue(Double) 
Converts a given test statistic to a pvalue.
(Overrides HypothesisTestTDistributionStatisticToPValue(Double).)  
StatisticToPValue(Double, DistributionTail) 
Converts a given test statistic to a pvalue.
 
ToString 
Converts the numeric PValue of this test to its equivalent string representation.
(Inherited from HypothesisTestTDistribution.)  
ToString(String, IFormatProvider) 
Converts the numeric PValue of this test to its equivalent string representation.
(Inherited from HypothesisTestTDistribution.) 
Name  Description  

HasMethod 
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)  
IsEqual  Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices. (Defined by Matrix.)  
ToT 
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) 
The term Ztest is often used to refer specifically to the onesample location test comparing the mean of a set of measurements to a given constant. Due to the central limit theorem, many test statistics are approximately normally distributed for large samples. Therefore, many statistical tests can be performed as approximate Ztests if the sample size is large.
If the test is Significant, the null hypothesis can be rejected in favor of the alternate hypothesis specified at the creation of the test.
This test supports creating power analyses through its Analysis property.
References:
This example has been gathered from the Wikipedia's page about the ZTest, available from: http://en.wikipedia.org/wiki/Ztest
Suppose there is a text comprehension test being run across a given demographic region. The mean score of the population from this entire region are around 100 points, with a standard deviation of 12 points.
There is a local school, however, whose 55 students attained an average score in the test of only about 96 points. Would their scores be surprisingly that low, or could this event have happened due to chance?
// So we would like to check that a sample of // 55 students with a mean score of 96 points: int sampleSize = 55; double sampleMean = 96; // Was expected to have happened by chance in a population with // an hypothesized mean of 100 points and standard deviation of // about 12 points: double standardDeviation = 12; double hypothesizedMean = 100; // So we start by creating the test: ZTest test = new ZTest(sampleMean, standardDeviation, sampleSize, hypothesizedMean, OneSampleHypothesis.ValueIsSmallerThanHypothesis); // Now, we can check whether this result would be // unlikely under a standard significance level: bool significant = test.Significant; // We can also check the test statistic and its PValue double statistic = test.Statistic; double pvalue = test.PValue;