What is the Interpretation of the p-Value from runstest() ?
Show older comments
For the function runstest the null hypothesis is "that the values in the data vector x come in random order."
Running 100 run tests on rand yields the following for the test decision and the p-value
rng(100);
for ii = 1:100
[h(ii),p(ii)] = runstest(rand(1e4,1));
end
plot(1:100,h,'-o',1:100,p,'-o')
In 97 cases, we can't reject the null hypothesis (is it surprising that the null hypothesis was rejected in even three of the cases?).
My real question is about the variability in the p-value. The doc states that: "Small values of p cast doubt on the validity of the null hypothesis."
How small is "small" in this context? What does "cast doubt" mean?
Regardless, is it expected that the p-value would have such variability when running the same test on data sets that, I would hope, are (in some sense) the same wrt to their "random ordering?
2 Comments
dpb
on 18 Sep 2024
I am not familiar with the specific test and the MATLAB doc doesn't provide any details of the specific test statistic being calculated, so would have to dig into the bowels some to comment much more in depth.
The use of "cast doubt" is simply editorial; it has no technical meaning other than smaller values are less likely (under the test statistic) to have come from "random" sequences.
The definition of random for this purpose simply means how many consecutive values are above/below the mean of the sample; with a unform distribution, the probablility is 50:50 any given value is above/below the mean and the probability of the next being of the same direction of the previous is (theoretically) independent of the prior value as well. Given that, it doesn't seem at all surprising to me that whether 2, 3, ..., N consecutive values are above/below the mean would be quite variable from one sample to another
Paul
on 19 Sep 2024
Accepted Answer
More Answers (0)
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!