2
$\begingroup$

I have a time series of data (about 300-750 elements, depending on the sample) and a model that has some random residues. I used the Kolmogorov–Smirnov test to make sure that the normality hypothesis can't be rejected, so I assume that the residuals are normally distributed. But now I guess I should test if they are independent of each other - so that there is no autoregression? Which test should I use (preferably one that is easily implementable in java)?

$\endgroup$
2
$\begingroup$

You could try Runs test for randomness. I am not familiar with Java functions. I got a link related to runs test that may useful to you. JAVA NPST. Apart from this you could do durbin-watson test or Ljung-Box portmanteau test. Most important is the visual check of time series plot ( I guess you have done this already).

$\endgroup$
  • $\begingroup$ If you go with Ljung-Box, which is easy to program, you might want to check out this question and answers. $\endgroup$ – jbowman Jan 3 '12 at 17:22
  • $\begingroup$ Hi, which flavor of the runs test? Calculating the runs when the value increases and decreases? $\endgroup$ – Grzenio Jan 4 '12 at 13:09
  • $\begingroup$ You need to check both. The rejection rule is $R \leq C_1$ or $R \geq C_2$, where $C_1$ and $C_2$ are critical values obtained from table (or from normal distribution for large sample) $\endgroup$ – vinux Jan 4 '12 at 14:08
1
$\begingroup$

Another option is a permutation test. Compute a measure of autocorrelation, then randomly permute the values and recompute the same measure of autocorrelation. Do the permute and recompute step a bunch of times (like 2,000 overall) and compare the value for the original ordering to the permuted values to do the test.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.