KolmogorovSmirnovTest (FPScript)

21.09.2021

Carries out a Kolmogorov-Smirnov goodness-of-fit test. The test checks whether the sample passed corresponds to the normal or exponential distribution specified.

Syntax

KolmogorovSmirnovTest(Sample, ErrorProbability, Assessment, Mean, Variance)
or
KolmogorovSmirnovTest(Sample, ErrorProbability, Assessment, Lambda)

 

The syntax of the KolmogorovSmirnovTest function consists of the following parts:

Part

Description

Sample

The sample to be tested.

Permitted data structures are data series und signal. All numeric data types are permitted.

For complex data types the absolute value is formed.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

ErrorProbability

Specifies the error probability, on which the test is to be based, as a percentage. Here, the values 1, 5 and 10 % are permitted.

Permitted data structures are scalar value. All numeric data types are permitted. The argument is transformed to the unit %.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

Assessment

A Boolean value that specifies whether the following were estimated from the sample or not. This affects the critical values on which the test is based.

Permitted data structures are scalar value. Supported data types are Boolean value.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

Mean

Specifies the mean of the normal distribution to be tested.

Permitted data structures are scalar value. All numeric data types are permitted.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

Variance

Specifies the variance of the normal distribution to be tested.

Permitted data structures are scalar value. All numeric data types are permitted.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

Lambda

Specifies the lambda parameter of the exponential distribution to be tested.

Permitted data structures are scalar value. All numeric data types are permitted.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

Remarks

As the result the function returns a scalar value of data type 32-bit integer.

The sample must have a size of at least 5 values.

The test first determines the empirical density function of the sample and then forms the greatest difference between this density and the distribution density function to be tested. This difference is compared to a critical value.

The following values are possible as the result:

Value

Interpretation

0

The hypothesis was rejected, i.e. the sample does not originate from a population with the distribution specified.

1

The hypothesis was accepted, i.e. the sample originates from a population with the distribution specified.

2

No result could be determined (see above).

Available in

Option Enhanced Statistics

Examples

From a quantity of screws, only a random 20 were selected and their diameter was measured (in mm). The Kolmogorov-Smirnov goodness-of-fit test is used to an error probability of 5 % to determine whether the diameter of the measured screws originated from a normal distribution with the mean of 0.75 and variance of 0.001.

Dim data = {0.79 mm, 0.68, 0.75, 0.73, 0.69, 0.77, 0.76, 0.74, 0.73, 0.68, 0.72, 0.75, 0.71, 0.76, 0.69, 0.72, 0.70, 0.77, 0.71, 0.74}
KolmogorovSmirnovTest(s, 5 %, FALSE, 0.75 mm, 0.001 mm^2)
 

Results in 1s. The hypothesis cannot be rejected, i.e. the sample originates from a population with the normal distribution specified.

See Also

ChiSquareTest Function

Goodness-of-Fit Test Analysis Object

Statistics Option

References

[1] "Hartung, Joachim": "Statistik (Statistics), 9th Edition", page 183 ff, 226 ff. "Oldenbourg Verlag GmbH, Munich",1993.ISBN 3-486-22055-1.

Share article or send as email:

You might be interested in these articles