Suppose that I have a time series, $x_{1:n}$, and I would like to test whether they are all independent samples from the uniform distribution on $[0,1]$. This is a somewhat basic question, but how do I correctly test for that?
I am using the Kolmogorov-Smirnov test to check that they are uniform.
One thing I can do is calculate the autocorrelation function for $x_{1:n}-\frac12$, which should be small. It should lie within approximately $\pm 2/\sqrt{n}$ and I can calculate the Ljung-Box and Box-Pierce statistics. My only concern with them is that if I repeatedly calculate them for just known-random data, e.g., rand(1000,1)
, the distribution of p-values for both of them is not quite uniform. Which, if I understand correctly, means they are not very good tests. What would be a good test for independence?