# Two-sample Kolmogorov-Smirnov test

In summary, you are planning to use a two-sample Kolmogorov-Smirnov test to compare the distribution of your real data and the data generated from your model. This non-parametric test is suitable for both continuous and discrete data and will produce a p-value to help determine if the two distributions are significantly different.
Hello,

Hello,

I have recorded some discrete data with an unspecified distribution.

I have generated some discrete data from a model.

I'm looking to check to see if the generated data has the same distribution as the real data.

If the data was continious, I would use a Q-Q plot and a striaght line would indicate that it is true.

As the data is discrete, I need another test.

Can you use a two-sample Kolmogorov-Smirnov test to test the hypothesis that the two samples come from the same distribution?

Here is a link to the test http://www.mathworks.co.uk/help/stats/kstest2.html

Kind regards

J

enny

Hello Jenny,

Thank you for reaching out regarding your data analysis. It sounds like you are on the right track in using a two-sample Kolmogorov-Smirnov test to compare the distribution of your real data and the data generated from your model.

The two-sample Kolmogorov-Smirnov test is a non-parametric test that can be used to compare two samples and determine if they come from the same distribution. It is suitable for both continuous and discrete data.

To perform this test, you will need to have at least 20 data points in each sample and the data should be independent. The test will produce a p-value, which can help you determine if there is a significant difference between the two distributions. A low p-value (typically less than 0.05) would indicate that the two distributions are significantly different, while a high p-value would suggest that they are similar.

I hope this helps with your analysis. Best of luck with your research!

## 1. What is a two-sample Kolmogorov-Smirnov test?

The two-sample Kolmogorov-Smirnov test is a statistical test used to compare two independent samples and determine if they come from the same underlying distribution. It is a non-parametric test, meaning it does not make any assumptions about the shape or parameters of the distributions being compared.

## 2. When should a two-sample Kolmogorov-Smirnov test be used?

A two-sample Kolmogorov-Smirnov test should be used when you want to test whether two samples come from the same population or distribution. It is commonly used in fields such as economics, finance, and biology to compare two groups or treatments.

## 3. How does a two-sample Kolmogorov-Smirnov test work?

The test works by calculating the maximum difference between the cumulative distribution functions (CDFs) of the two samples. This difference, known as the test statistic, is compared to a critical value from a table to determine if the two samples are significantly different. The test assumes that the samples are independent and the data is continuous.

## 4. What are the advantages of using a two-sample Kolmogorov-Smirnov test?

One advantage of using a two-sample Kolmogorov-Smirnov test is that it can be used to compare distributions that are not normally distributed or have unknown parameters. It is also a non-parametric test, so it does not require assumptions about the shape or parameters of the distributions being compared. Additionally, it is a more powerful test than other non-parametric tests, such as the Mann-Whitney U test, when the sample sizes are large.

## 5. What are the limitations of a two-sample Kolmogorov-Smirnov test?

One limitation of the test is that it is sensitive to differences in the shape of the distributions being compared, rather than just differences in the location or spread. It is also important to note that the test assumes independent samples and continuous data. If these assumptions are not met, the results of the test may not be accurate. Additionally, the test may not be appropriate for small sample sizes.

Replies
3
Views
1K
Replies
9
Views
2K
Replies
7
Views
1K
Replies
1
Views
997
Replies
1
Views
2K
Replies
30
Views
3K
Replies
3
Views
1K
Replies
4
Views
1K
Replies
4
Views
2K
Replies
9
Views
2K