Why p-value is 0 when testing the distribution

70,586

Solution 1

When you perform a statistical test, you have two hypothesis:

  • the null hypothesis. Often call H_0. In your case, the null hypothesis is that the data comes from a Normal distribution.
  • the alternate hypothesis. Often call H_1 or H_A. In your case, the data comes from a non-normal distribution.

A small p-value indicates that the observations are inconsistent with the Null hypothesis. The typical pharse used is, "we reject the null hypothesis". That means that your data doesn't seem to be normal.

A few other pointers.

  1. Plot your data as a histogram. Then superimpose a normal density with the mean and variance equal to that of your data. Does it look similar?
  2. Why does it matter if your data is Normal?
  3. Statistical questions are probably best asked at the statistics stackexchange site.
  4. See the wikipedia Normality tests page for further details.

Solution 2

Maybe you forgot this: Matlab does NOT return the p-value for a test! The standard output of testing in Matlab is a 0-1 output! 1 indicates a rejection of the null hypothesis at the 5% significance level, 0 indicates a failure to reject the null hypothesis at the 5% significance level. If you are interested in your p-value, just do this:

[H,P] = KSTEST(...) also returns the asymptotic P-value P.

H is the 0-1 variable (and the standard output if you don't name any variables) and P is your p-value.

Solution 3

In general, smaller p-values are desirable. The smaller the p-value, the more certainty there is that the null hypothesis can be rejected. For example, in the case of the function KSTEST a very small p-value would indicate with a great deal of significance that the data distribution you are testing does not follow a standard normal distribution (i.e. the null hypothesis).

If you are always getting exactly zero, and not just really small values that are being rounded off when displayed, you may want to check for the possibility that the statistical functions are failing and returning garbage results. Here are some things to look for:

  • Look at the other outputs from the functions you are using (i.e. the test statistic, etc.) to make sure they make sense.
  • Make sure you're not getting any warning messages during the running of the functions.
Share:
70,586
Bargitta
Author by

Bargitta

A software developer involved in services computing.

Updated on February 02, 2020

Comments

  • Bargitta
    Bargitta about 4 years

    I wanna test the distribution of a sample, I have tried several test like kstest. But I always got the result of p-value=0. Why?

  • Bargitta
    Bargitta over 13 years
    thank you, gnovice.I also wanna know that which test you will choose when testing the normal distribution,jbtest or kstest? Will the two always have the same results? (thank you in advance)