How to check for data normality using kstest?
123 views (last 30 days)
Show older comments
Suppose I have a data set with about 100 numbers as listed below, how do I properly determine whether or not this data set is a normally distributed using the kstest()? The description mentioned to minus it by the mean and then divide it by standard deviation before putting in the kstest(), but do I need to do that for this case?
Dataset = [64 66 80 66 76 55 57 72 76 68 81 70 82 80 71 74 83 80 76 78 72 74 76 65 61 75 68 80 88 73 76 71 70 74 70 76 66 72 80 75 81 82 84 86 71 82 77 78 80 78 88 77 73 72 74 68 75 62 65 71 72 75 72 75 76 73 81 71 61 61 71 81 73 67 77 77 80 57 70 73 80 75 70 75 74 70 68 80 85 81 71 80 80 78 75 75 80 76 82 75 57];
PS: I'm testing on whether the data is normal only. I must use kstest to find it.
0 Comments
Accepted Answer
Rik
on 16 Sep 2021
If you want to test if your data is from a standard normal distribution you should not change it before calling kstest.
If you want to test if your data is normally distributed (but not necessarily from the standard normal distribution), you will first have to normalize it by subtracting the mean and dividing by the standard deviation.
Which of the two is relevant for your case depends on your context. I'm guessing you want the second one, otherwise you don't need the test.
2 Comments
Rik
on 18 Sep 2021
That is easy to determine: since your data is absolutely not from a standard normal distribution, you can feed it your unaltered data and see the result. You can also read the documentation:
help kstest
[h,p]=kstest([64 66 80 66 76 55 57 72 76 68 81 70 82 80 71 74 83 80 76 78 72 74 76 65 61 75 68 80 88 73 76 71 70 74 70 76 66 72 80 75 81 82 84 86 71 82 77 78 80 78 88 77 73 72 74 68 75 62 65 71 72 75 72 75 76 73 81 71 61 61 71 81 73 67 77 77 80 57 70 73 80 75 70 75 74 70 68 80 85 81 71 80 80 78 75 75 80 76 82 75 57])
So you can see your answer here: a small p value means it is less likely to be from a normal distribution.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!