Runstest: a good interpretation
1 view (last 30 days)
Show older comments
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
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.
Answers (0)
See Also
Categories
Find more on Hypothesis Tests in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!