Test of normal distribution of MATLAB (final) _matlab
Source: Internet
Author: User
% normal distribution test%%c.s. Ruan
X Figure hist (x),% frequency histogram (see whether the naked eye is symmetrical, middle more, both sides less) figure; Histfit (x);% normal curve fitting normfit (x);% normality test (whether discrete points are distributed on a straight line, indicating that samples are from normal distribution, otherwise non-normal distribution)% parameter estimation [muhat,sigmahat,muci,sigmaci]= Normfit (x);%muhat mean, sigmahat variance, Muci mean 0.95 confidence interval, Sigmaci variance 0.95 confidence Interval% hypothesis test (now if the variance is unknown, verify that the mean value is Mahat) [h,sig,ci]= TTest (X,muhat); %h=0, accept the assumption that the mean =mahat% of which H is a Boolean variable, h=0 that the 0 hypothesis is not rejected, the assumption that the mean value is mahat is reasonable. If H=1 is the opposite;%ci represents a confidence interval of 0.95. If the%sig is larger than 0.5, it cannot reject the 0 hypothesis, otherwise.
------------------------percent more formal test method of%kstest Kolmogorov-smirnov Normal test, the sample and standard normal distribution (mean 0, Variance is 1) to compare, do not conform to normal distribution return 1, otherwise return 0 ; The function can also be used for testing other distribution types; [H,p,jbstat,cv]=kstest (x); %h0: Obey the normal n (0,1)
%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. [H,p,istat,cv]=lillietest (x); %h0: Obey N (MU,SIGMA2);
%jbtest Jarque-bera test. Similar to lilliefors test, but not for small samples. [H,p,jbstat,cv]=jbtest (x); %h0: Obey the normal n (MU,SIGMA2)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.