# What is Kolmogorov Smirnov test?

The Kolmogorov-Smirnov (KS) test is a non-parametric statistical test used to compare the empirical cumulative distribution function (ECDF) of a sample dataset with a theoretical cumulative distribution function (CDF) or with another empirical CDF. It assesses whether the two distributions differ significantly from each other.

The KS test is widely used in various fields, including statistics, engineering, finance, and biology, to determine if a sample comes from a population with a specific distribution. It's particularly useful when the underlying distribution of the data is unknown or does not follow a common parametric distribution.

The test statistic used in the KS test is the maximum vertical difference (D) between the two cumulative distribution functions. Mathematically, it is calculated as the maximum absolute difference between the empirical and theoretical CDFs:

D = max |Fn(x) - F(x)|

Where:

- Fn(x) is the empirical cumulative distribution function of the sample data,

- F(x) is the theoretical cumulative distribution function being tested against,

- | | denotes the absolute value, and

-max indicates the maximum value over all data points.

The KS test provides a p-value that indicates the probability of observing a test statistic as extreme as the one computed from the data, under the null hypothesis that the two distributions are identical. A small p-value suggests that the null hypothesis should be rejected, indicating a significant difference between the distributions.

One of the advantages of the KS test is its simplicity and flexibility. It does not rely on assumptions about the parameters of the distributions being compared, making it suitable for a wide range of applications. Additionally, it can be used for both continuous and discrete distributions.

However, the KS test has some limitations. It is sensitive to differences in shape, location, and scale between distributions but less sensitive to differences in the tails. Also, it may lack power when sample sizes are small.

In summary, the KS test is a valuable tool for assessing the goodness-of-fit of a sample to a theoretical distribution or comparing two samples' distributions. It provides a straightforward way to quantify differences between distributions and make informed decisions in various analytical and research contexts.

Name: Hidden