Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Testing how much random is my sample

  1. Mar 29, 2015 #1

    fluidistic

    User Avatar
    Gold Member

    Hello guys,
    I have a sample of about 400 natural numbers though I can get more numbers. To give you an idea the mean and the standard deviation are 29038031 and 1842882 respectively and I expect the numbers to follow a Gaussian distribution. I'd like to perform a test to tell me the probability that my sample is truly random. I just don't know which test to perform. I've read about diehard tests but I don't see how I could apply them.

    So I'd like to hear some suggestions. Thanks!

    Edit: 1st idea that I have: get more numbers. Then perform a Gaussian fit and calculate the residuals. Do the same for true random numbers following a Gaussian with the same mean and standard deviation and compare the residuals. I expect lower residuals with the true random numbers.

    Edit2: Nevermind this idea would be useless. It would tell me how far from a Gaussian my distribution of numbers is, not how random they are...
     
    Last edited: Mar 29, 2015
  2. jcsd
  3. Mar 29, 2015 #2

    marcusl

    User Avatar
    Science Advisor
    Gold Member

    A simple and intuitive way is to plot your histogrammed data on Gaussian "probability paper," so named from the days when plots were made on actual graph paper. You'll see visually how close to a Gaussian you are.
    http://en.wikipedia.org/wiki/Normal_probability_plot

    Other simple, but quantitative, tests include:
    a) Compute the skew and kurtosis and see how close to Gaussian they are (normal values are 0 and 3).
    b) The mean, mode and median are all equal for a normal distribution.

    More sophisticated tests abound. See, e.g.,
    http://en.wikipedia.org/wiki/Normality_test
     
  4. Mar 29, 2015 #3

    fluidistic

    User Avatar
    Gold Member

    I've just used the software maxima which performed a Shapiro-Wilk test to check whether my data follows a Gaussian and I think there are high chances that it does: it returned a Kendall's W of over 0.99 with a p-value near 0.27.
    The thing is that I am not sure that this is telling me anything about the randomness of my numbers which is what I'm looking for.
     
  5. Mar 29, 2015 #4

    WWGD

    User Avatar
    Science Advisor
    Gold Member

  6. Mar 29, 2015 #5

    fluidistic

    User Avatar
    Gold Member

    Thanks a lot! That's exactly what I was looking for, I'll try tomorrow.
    Meanwhile I tried a very similar test with R programming and the result was that there is a high probability that my data is random. (p-value was over 0.4 and the null hypothesis is that the data is random while the alternative hypothesis was non randomness in the data).
     
  7. Mar 30, 2015 #6

    WWGD

    User Avatar
    Science Advisor
    Gold Member

    Glad I could help.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Testing how much random is my sample
  1. Simple Random Sample (Replies: 2)

Loading...