I need to test if a vector of observed values are uniform distribution.

Lets assume:

  • This values are not a sample, but my entire universe.
  • I have a dataset of 12000 observations, where most of the data (80%) have the same value.
  • The range is not delimited.

I'm using this R code to test the uniformity with a significance level of 0.05

Pearson's Chi-squared Test for Count Data

    chi2IsUniform=(chisq.test(dataset)$p.value > 0.05)

These results are reliable?

Do I need to use Monte Carlo to compute p-values?

If yes, we have 2 extra options on this function:

*simulate.p.value: a logical indicating whether to compute p-values by Monte Carlo simulation. B: an integer specifying the number of replicates used in the Monte Carlo test. *

How many replicates do I have to use? It depends on my significance level?

    chi2IsUniform=(chisq.test(dataset, simulate.p.value = TRUE, B = 1000)$p.value > 0.05)
  • 1
    $\begingroup$ 1. "This values are not a sample, but my entire universe" ... then significance tests make no sense. If you have the population, you can see at a glance if it's actually uniform. $\quad$ 2. "most of the data (80%) have the same value" -- then how on earth could it be uniform? $\quad$ What is it you're trying to achieve? Why do you need to test this? $\endgroup$ – Glen_b Oct 7 '14 at 23:47
  • $\begingroup$ Tks for the answer. 1. How can I test this without the significance value? 2. The result will be used for a processing of this data that requires that the distribution is uniform. In some of my inputs, I have a heavy tail that requires another processing. In summary, what I have to do is to separate witch group of data are uniform, and witch group are heavy-tailed. $\endgroup$ – Rodrigo Queiroz Oct 8 '14 at 0:40
  • $\begingroup$ 1. "you can see at a glance if it's actually uniform". Just look at the distribution of values. Either they're uniform or they aren't. As I already explained before, for your situation they can't be uniform (80% in one value means less than 80% everywhere else -- not remotely uniform). $\ $ 2. Does the unmentioned processing also require a random sample from a population? $\ $ 3. It's possible to be neither uniform nor heavy-tailed. $\endgroup$ – Glen_b Oct 8 '14 at 0:45
  • 1
    $\begingroup$ 1. You said you don't have a sample but "the universe", so it's not a question of testing. Testing is for when you want to make inference about a population but don't have the population. You already have the population, there's no need to infer what you can see by inspection. 2. It's either uniform or it isn't. Do you want to ask a different question (such as 'how much does the non-uniformity I have matter for what I want to do?')? Even if you did have a sample, that's not answered by a goodness of fit test. But since you haven't said what you're doing I can't hope to address that ... (ctd) $\endgroup$ – Glen_b Oct 8 '14 at 1:19
  • 1
    $\begingroup$ I think you should probably do two things: (i) clearly describe what the "next step" actually is, so we can better assess what the actual requirements are, and (ii) consider whether the population you have is actually the target population of your inference ... because it increasingly sounds like it isn't -- and in that case it might in effect be a sample. $\endgroup$ – Glen_b Oct 8 '14 at 5:47

Your Answer

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

Browse other questions tagged or ask your own question.