MATLAB Normal distribution test:
(a) in the case of parameter estimation and hypothesis testing, it is usually assumed that the general obeys the normal distribution, although in many cases this assumption is reasonable, but it is necessary to examine the hypothesis when it is important to carry out a critical parameter estimation or hypothesis test, or when there is a greater suspicion of it, There are many kinds of methods to conduct the general normal test, the following is a brief introduction to the procedures provided in the MATLAB statistical Toolbox.
1) Jarque-bera inspection
By using the skewness G1 and kurtosis G2 of normal distribution, a distribution statistic (DOF n=2) containing g1,g2 is constructed, and for the significance level, when the distribution statistic is less than the distribution number, the H0 is accepted: The general obeys the normal distribution, otherwise the H0 is rejected, that is, the overall deviation is normal distribution. This test is suitable for large samples and should be used sparingly when the sample size is small. MATLAB command: H =jbtest (x), [H,P,JBSTAT,CV] =jbtest (X,alpha).
Example:
[H,p]=jbtest (a,0.05)
H is the test result, if h=0, it can be thought that X is obeys the normal distribution, if h=1, it can be denied that x obeys normal distribution;
P is to accept the hypothetical probability value, the more p is close to 0, then the original assumption of normal distribution can be rejected;
2) Kolmogorov-smirnov inspection
By comparing the empirical distribution function of a sample with a given distribution function, the sample is inferred from the totality of the given distribution function. The empirical distribution function of the sample of volume n is written as FN (x), it can be obtained by the proportion of the data of the sample small to x, the given distribution function as g (x), the statistic of the structure is, that is, the maximum value of the difference between the two distribution functions, for the hypothetical H0: the general obeys the given distribution G (X), and given, According to the limit distribution of DN (n??? The distribution of the statistics determines whether the quantity limit of the H0 is accepted.
Because this test requires a given g (x), it is only standard normal test when used in the normal test, namely H0: The general obeys the standard distribution. MATLAB command: H =kstest (x).
Example:
A=a (:);
alpha=0.05;
[Mu,sigma]=normfit (A);
P1=NORMCDF (A,MU,SIGMA);
[H1,s1]=kstest (A,[a,p1],alpha);
N=length (A);
If h1==0
Disp (' This data obeys a normal distribution. ')
End
3) lilliefors inspection
It will improve the Kolmogorov-smirnov test for general normal test, namely H0: The general obeys the normal distribution, which is estimated by the sample mean value and variance. MATLAB command:
H =lillietest (x), [H,p,lstat,cv]=lillietest (X,alpha).
4 There is another method: first of all, standardize the data: Z = Zscore (X), and then in the Kolmogorov-smirnov test of 2), check whether it is a standard normal distribution, similar to the improvement of Method 2.
Summarize:
To a group of samples for normal testing, in Matlab, a method is to use Normplot to draw samples, if all distributed in a straight line, it indicates that the sample from the normal distribution, otherwise non-normal distribution.
MATLAB also provides several more formal test methods:
Kstest Kolmogorov-smirnov Normal test, the sample is compared with the standard normal distribution (mean 0, Variance is 1), does not conform to the normal distribution to return 1, otherwise returns 0; The function can also be used for testing other distribution types;
Lillietest lilliefors test. Unlike Kstest, the test target is not a standard normal state, but it has the same distribution as the mean and variance of the sample.
Jbtest Jarque-bera test. Similar to lilliefors test, but not for small samples.