# Questions tagged [kolmogorov-smirnov]

The Kolmogorov-Smirnov test is a test for goodness of fit of data to a distribution. It is often used to test whether a variable is normally distributed.

525 questions
Filter by
Sorted by
Tagged with
22 views

### How to test if the influence of changing a parameter is larger than the influence of random noise?

I have an algorithm under test that generates a vector of results, influenced by an underlying RNG. I want to test whether, when I change parameter a, the results change 'more' then when changing the ...
32 views

### Distribution of p-values from scipy ks-test

I wast trying to understand how kstest works using scipy. I generated chi2 random variables and then checked if the values follow the chi2 distribution. The codes are shown below. ...
20 views

### Probability of sample distribution being different from population distribution

I have a population distribution I know is exponential, with mean $\mu_1$. I also have a sample of the population (of size $n$) that appears to be exponential with mean $\mu_2$. I have all the $n$ ...
47 views

### Kolmogorov-Smirnov test returning a p-value of 1

I have two datasets data1 and data2 with different sample sizes: over 50,000 and around 8,000, respectively. These data consist ...
24 views

### Is the set of distribution $\{ X | \max_t |f_X(t) - f_Y(t)| \leq \epsilon \}$ convex, where f is the cdf or inverse cdf?

I'm trying to figure out if the set is convex, where the maximum difference between cdf(or inverse cdf) of X and a reference distribution Y is smaller than $\epsilon$. 1. Let $f_X(t)$ denote the cdf ...
42 views

### Testing uniform distribution of a discrete function derived from a random number generator

(Forewarning: I'm a programmer, not a statistician, so I apologize in advance for any misuse of terminology!) I'm testing a known random number generator that implements the PCG algorithm. This RNG ...
9 views

### Is KS statstic (in classification) from ROC Curve same as K-S from cum Gain curve or PR Curve?

This is related to classification problems (specifically binary classification problems covered in scoring) where curves referenced below are used. I understand each of these curves for a classifier ...
12 views

### Comparison of medians in data with multimodal distributions

I'm comparing continuous data obtained at two different time periods with the distributions seen below. They appear fairly similar, but they're clearly non-normal. The ideal hypothesis is that the ...
33 views

### I wanna know how to compare the distribution similarity of two d-dimensional sample sets

I wanna know how to compare the distribution similarity of two d-dimensional sample sets, I know Kolmogorov-Smirnov, but this algorithm can only be used in one dimension, right? I also know the KL ...
52 views

### How to differentiate statistically between two numerical continuous datasets?

Sample from: Green - Gamma(45, 1); Red - Normal(375, 19) These two samples clearly come from two different distributions. Is it possible to verify that these two samples come from two different ...
21 views

### different results between the published paper and my code to calculate the p-value of Kolmogorov–Smirnov (K–S) test using R

I want to know if the following distributions fit the given data well or not. I used the Kolmogorov–Smirnov (K–S) statistic for the following two distributions but, i obtained different p-value of k-s ...
63 views

### Kolmogorov-Smirnov two-sample test p-value evaluation

I'm using python's scpipy implementation of the Kolmogorov-Smirnov two-sample test (ks_2samp). Q1: Why are my p-values in the examples below so low, specifically on the first example? Q2: Can I ...
19 views

### Why are people using KS statistic to choose cutoff for binary predictions?

I've seen that people are sometimes using Kolmogorov-Smirnov statistic to determine a cutoff in a binary classification models, such as logistic regression. However, i do not fully understand why and ...
19 views

### Statistical power of the Lilliefors test: how to compare results for samples of different sizes?

The power of the Lilliefors test (LT) strongly depends on the sample size. I need to apply LT to a discrete distribution to find the minimum value m_min above which it is exponential. I need to do it ...
17 views

### Feature selection using LASSO and KS tests

I have derived a binary classification model using LASSO-based feature selection and got a list of 10 features that gave an overall AUROC 0f 0.83. Now I wanted to check whether there exist any class-...
22 views

### KS Test for Hawkes Process

I am analyzing some data by applying 1d-Hawkes processes. To evaluate the fit of the model itself (and particularly the chosen kernel, i.e. exponential), I am performing a KS test. However, it is not ...
40 views

### Is the following approach a reasonable way of defining $p$-value thresholds?

I have many small sets of data (each sample containing 8 to 64 individual points) which I would like to test for normality. I want to do this with two main tests: Shapiro-Wilk Kolmogorov–Smirnov ...
6 views

### Comparing species size distribution across multiple habitats

I am looking at one species' size distribution across three primary habitats, we'll call them Habitat A, B, and C for simplicity. I have taken multiple samples (seine tows) within each habitat (n ...
24 views

### two-sample Kolmogorov-Smirnov test suggest that sample with the same data generating process from different populations

I have two different samples I need to test if they are drawn from the same population distribution. The two samples are of the volatility of an asset that I simulated. Since the data is simulated I ...
35 views

### Intepretation of $p$-values for a Kolmogorov-Smirnov test

I'm using a Kolmogorov-Smirnov test to examine how normal (or Gaussian) some data sets I have are. I am having trouble with interpreting the $p$-values (surprise surprise). My present understanding is ...
122 views

### Kolmogorov-Smirnov and AIC giving opposite goodness-of-fit results. Is this possible/surprising/normal?

I have some data on the duration of several activities (rounded to the nearest half hour). I'm trying to add up these random variables (one per activity) so that I can calculate the total duration of ...
30 views

### comparing gene expression distributions with replicates

I have gene expression data for single cells (hundreds per sample) in two conditions that I would like to compare. For each condition I have 4 replicates. So in essence I need to compare 4 ...
36 views

### Is it accurate to take the maximum distance between CDF and ECDF only at the edges? (Kolmogorov-Smirnov Test)

I have two samples, one obtained empirically and the other is the result of a simulation. I want to tune the simulation so that the result resembles the reality, for that I will minimize the KS ...
24 views

### KS two sample test, p-value equal to 1

I have done a KS two sample test with the following samples: I have received a P-value of 1, I was expecting a high p-value but I thought this value can never reach 1 unless both samples are exactly ...
60 views

### Appropiate test for comparing integer distance distributions

I am trying to determine if wildfires occur closer to forests or not. For this, I have two matrices with the same shape: A matrix of ones and zeros where each value represents whether a fire is ...
14 views

### Significant change over NxM distributions

I have 100 sets of data, each of which consists of ~ 15 distributions along time, I've attached a figure of 1 of these sets to hopefully clear up what I mean. The plot shows the 95% confidence ...
43 views

### Distribution Selection based on Kolmogorov Smirnov Test

I am trying to model the distribution of some non normal data, to do so i am fitting many different distributions(Student, Pareto...) to the data. When computing the Kolmogorov Smirnov Statistic for ...
31 views

### What distribution could the data stem from?

From checking the histogram of the distribution I had the intuition that the data could follow a Poisson or an exponential distribtuion. However, Lilliefors test that the data is exponentially ...
26 views

### Why do I have different KS test results?

I have been using scipython ks2samp to apply a two sided , sample KS test to some data. import scipy.stats as ss import numpy as np All_smirnoff = ss.ks_2samp(X, Y) where X and Y are two 1D numpy ...
36 views

### goodness-of-fit and bootstrap

Assume one has two data samples: $X = \{ x_{1}, \dots, x_{n} \}$ and $Y = \{y_{1}, \dots, y_{m}\}$. Next, we aim to check if the data $Y$ was generated by the same data generating process (DGP) as $X$ ...
19 views

### Unexpected behaviour of Anderson Darling test for normality for low sample size

I’m testing the power of the Anderson Darling test to detect deviations from standard normal distributions. I’m calibrating the AD test statistic numerically using python and I noticed an unexpected ...
42 views

### Identifying data generating process by testing

Assume one has two data samples: the first one , $X = x_{1}, \dots, x_{n}$ and second, $Y = y_{1}, \dots, y_{m}$, with $m \ll n$. I aim to check if the data $Y$ was generated by the same data ...
14 views

### Chapman kolmogrovs equation diffrential vs integrated

I wasstudying about the markov chains and jumps properties and ways to solve and form equation about them when I came across the chapman kolmogrovs equation. So i just wanted to ask when should i use ...
40 views

### Two-sample Kolmogorov-Smirnov, Anderson-Darling, and after?

I am trying to investigate the differences between two datasets. Each one is composed of 20 000 elements obtained from a Monte-Carlo method whose implementation slightly differs in both cases. I'd ...
30 views

### p-value to Z-statistic for a KS test

Say you had a two tailed normal distribution A for some dataset, and you then measured the probability that some set of data points ...
59 views

### How to find ks test statistic using the given maximum likelihood estimator values and a sorted data in R?

The random variable Y is said to have a two-parameter APE distribution denoted by APE(α, λ), with the shape and scale parameters as α > 0 and λ > 0, respectively, if the PDF of Y for y > 0 is ...
29 views

### p-values not uniform in KS simulation with estimated parameters

I want to perform a bootstrap/simulation of the significance of a KS test in some observed data and have come up with some synthetic examples to make sure my code works, which I base off Greg Snow's ...
28 views

### Finding the difference between a normally distributed random number and randn with an offset using Kolmogorov-Smirnov test and Chi-square test

A normally disturbed random number is generated using randn function in Python. The KS test and Chi-square test is performed to check if the generated numbers belong to a Gaussian (zero mean, unit ...
48 views

### power of paired Kolmogorow-Smirnov test

Is the following conclusion correct? Assume I have two data samples, with $n$ and $m$ the sizes of first and second samples respectively. Next, I perform Kolmogorov-Smirnov test with some significance ...
29 views

### 2D-KS test vs Mann–Whitney U test

Probably this is an easy thing, but I want to know what is the difference between 2D-KS test and Mann–Whitney U test and when to use which one? What I have understood that Mann–Whitney U test is a non-...
20 views

### Comparing similarity of samples under time-dependant noise (KS-test for dependant samples)

I'm measuring response times of a process under different inputs and want to check if the input correlates with the response time. The problem is that the differences I'm expecting are small while ...
49 views

### Testing for uniformity of p-values with multi-modal samples

I'm working with data that is multi-modal, I need to be able to check if the individual samples are statistically distinct or not, so I'm running KS-test against pairs of samples. But I've noticed ...
41 views

### Simulating p-value statistics for Liliefors test (Python statsmodels)

Python statsmodels has an implementation of Lilliefors' test for goodness of fit (i.e. if the parameters of the distribution were obtained from fitting the data and not per-determined as in the ...
142 views

### Kolmogorov-Smirov two sample test, ties — will adding random noise fix the problem?

There are a lot of questions on this site about warning for "ties" in the Kolmogorov-Smirnov test. Here are a few of those questions. Is there an alternative to the Kolmogorov-Smirnov test ...
11 views

### Determine if a distribution of ranks is significantly skewed towards low values

I have N vectors of varying length. The values are samples of ranks that have been normalized to be between zero and one. I would like to determine the M vectors (M < N), for which the distribution ...
130 views

### bootstrap KS 2 sample test

I have two datasets $S_1$ and $S_2$. I can run KS 2 samples test on these datasets to obtain the value of the KS 2 samples test. Is there a correct way to bootstrap the KS 2 sample test using the ...
26 views

### How to construct Kolmogorov Smirnov test to check which distribution fits to given data in R

So, if for example I generate random sample of 1000 from exponential distribution and then simulate ks.test. for many times I get a normally distributed data, here is the code: ...
97 views

### Feature selection by doing pairwise KS test between different features in a dataset

I am trying to build a supervised learning model (binary class) and I wanted to check whether the features belonging to the respective classes come from the same distribution or not. Because the ones ...
If I estimate the parameters of a distribution $\theta$ using MLE. Can I use the Kolmogorov Smirnov test to check the goodness of the fitted model?