Runstest: a good interpretation

1 view (last 30 days)
Damiano Capocci
Damiano Capocci on 31 Mar 2018
Commented: Damiano Capocci on 1 Apr 2018
I've found this thing:
I generate 100000 random numb through rand but sometimes the null hypotesis is rejected. For see this thing here is the code:
tr = 300;
hyp = nan(1,tr);
for n = 1:tr
a=rand(1,100000);
[h,p]=runstest(a,median(a));
hyp(n) = h;
end
perc_one=size(find(hyp),2)/300;
where in my case:
perc_one=0.04
How could we interpret runstest? ok it tests the randomness of the order but in each step of the previous generation the coeff of correlation (corrcoef) is near zero so i dont understand how these two tests are related.
  2 Comments
dpb
dpb on 1 Apr 2018
They're not all that directly related; one is the overall test of the whole sample as an aggregate; the other tests whether there are sub-sequences within the series that may appear non-random.
Also, remember that on occasion a truly random sample may just "appear" nonrandom. You can toss 5 heads in a row with a fair coin.
Damiano Capocci
Damiano Capocci on 1 Apr 2018
Just few hours ago I made this point. :)

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!