AndersonDarlingTest Class |
Namespace: Accord.Statistics.Testing
[SerializableAttribute] public class AndersonDarlingTest : HypothesisTest<AndersonDarlingDistribution>, IHypothesisTest<AndersonDarlingDistribution>, IHypothesisTest
The AndersonDarlingTest type exposes the following members.
Name | Description | |
---|---|---|
AndersonDarlingTest |
Creates a new Anderson-Darling test.
|
Name | Description | |
---|---|---|
CriticalValue |
Gets the critical value for the current significance level.
(Inherited from HypothesisTestTDistribution.) | |
PValue |
Gets the P-value 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.) | |
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.) | |
TheoreticalDistribution |
Gets the theoretical, hypothesized distribution for the samples,
which should have been stated before any measurements.
|
Name | Description | |
---|---|---|
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.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetStatistic |
Gets the Anderson-Darling statistic for the samples and target distribution.
| |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
OnSizeChanged |
Called whenever the test significance level changes.
(Inherited from HypothesisTestTDistribution.) | |
PValueToStatistic |
Not supported.
(Overrides HypothesisTestTDistributionPValueToStatistic(Double).) | |
StatisticToPValue |
Converts a given test statistic to a p-value.
(Overrides HypothesisTestTDistributionStatisticToPValue(Double).) | |
ToString |
Converts the numeric P-Value of this test to its equivalent string representation.
(Inherited from HypothesisTestTDistribution.) | |
ToString(String, IFormatProvider) |
Converts the numeric P-Value 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.) | |
To(Type) | Overloaded.
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.) | |
ToT | Overloaded.
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.) |
// Test against a standard Uniform distribution // References: http://www.math.nsysu.edu.tw/~lomn/homepage/class/92/kstest/kolmogorov.pdf // Suppose we got a new sample, and we would like to test whether this // sample seems to have originated from a uniform continuous distribution. // double[] sample = { 0.621, 0.503, 0.203, 0.477, 0.710, 0.581, 0.329, 0.480, 0.554, 0.382 }; // First, we create the distribution we would like to test against: // var distribution = UniformContinuousDistribution.Standard; // Now we can define our hypothesis. The null hypothesis is that the sample // comes from a standard uniform distribution, while the alternate is that // the sample is not from a standard uniform distribution. // var adtest = new AndersonDarlingTest(sample, distribution); double statistic = adtest.Statistic; // 1.3891622091168489561 double pvalue = adtest.PValue; // 0.2052 bool significant = adtest.Significant; // false // Since the null hypothesis could not be rejected, then the sample // can perhaps be from a uniform distribution. However, please note // that this doesn't means that the sample *is* from the uniform, it // only means that we could not rule out the possibility.
// Test against a Normal distribution // This time, let's see if the same sample from the previous example // could have originated from a standard Normal (Gaussian) distribution. // double[] sample = { 0.621, 0.503, 0.203, 0.477, 0.710, 0.581, 0.329, 0.480, 0.554, 0.382 }; // Let's estimate a new Normal distribution using the sample NormalDistribution distribution = NormalDistribution.Estimate(sample); // Now, we can create a new Anderson-Darling's test: var ad = new AndersonDarlingTest(sample, distribution); // We can then compute the test statistic, // the test p-value and its significance: double statistic = ad.Statistic; // 0.1796 double pvalue = ad.PValue; // 0.8884 bool significant = ad.Significant; // false