用matlab软件实现Kolmogorov-Smirnov检验 - Freya's Blog - New Morning

用matlab软件实现Kolmogorov-Smirnov检验

云菲 posted @ 2011年5月19日 09:43 in matlab with tags k-s检验 经验分布函数 理论分布函数 , 16131 阅读

K-S检验是来自某一特定分布的方法。它的检验方法是以样本数据的经验分布函数与特定理论分布比较,若两者间的差距很小,则推论该样本取自某特定分布族。

即对于假设检验问题:

H=0:样本所来自的总体分布服从某特定分布;

H=1:样本所来自的总体分布不服从特定分布。

k-s检验的检验统计量是

 $$max(|F_n(x)-F(x)|)$$

其中,$$F_n(x)$$是经验分布函数,$F(x)$是理论分布函数。

经验分布函数:

$X_1,X_2,...X_n$是抽自总体X的一个样本,观察值为$x_1,x_2,...x_n$,次序观测值为${x_{(1)}}\le{x_{(2)}}\le...\le{x_{(n)}}$,则总体X的经验分布函数定义为

$F_n(x)=\frac{Observed~values~no.~which~is~smaller~than~x~in~sample}{n},\forall{x}\in{R}.$

$F_n(x)=\begin{cases}0&x\leq{x_{(1)}}\cr\frac{k}{n}&x_{(k)}\le{x}\leq{x_{(k+1)}},k=1,...,n-1\\1&x>{x_{(n)}}$

理论分布函数:

由于我们产生的是服从0-1均匀分布的随机数,(a,b)均匀分布的分布函数为

$F(x)=\begin{cases}0&x<a\cr\frac{x-a}{b-a}&a\leq{x}<b\\1&x\geq{b}$

将a=0,b=1代入公式,可得到数据的理论分布函数。

matlab代码如下:

path=strcat(pwd,'\filename');
x=importdata(path);
x=sort(x);
                 
%画出经验分布函数
figure
cdfplot(x);
hold on
%画出标准分布函数
plot(x,unifcdf(x,0,1),'r-');
hold off
    
%检验数据序列符合均匀分布的程度
[H,pvalue]=kstest(x[x,unifcdf(x,0,1)],0.05);

 

  • 无匹配
cleaning company in 说:
2019年9月14日 15:26

When you own/rent your personal property or experience property rentals you ought to lease apart, cleanliness is really important. What somewhat janitorial services are presented? When it arrives to cleaning, reputation is really important. You want to look through service that one can count through clean lacking stealing, since cleaning regularly takes space when home buyers or laborers are apart. The housecleaning supplies who are used are likewise important. You prefer to be sure that they will be Eco-friendly and additionally safe just for kids (and additionally pets assuming they are able).

Read more 说:
2019年11月02日 19:29

Very useful information for people, I think this is what everyone needs. Thanks for this information, I think it will come in handy in the future.

www.thaicitrustechno 说:
2019年11月13日 17:27

Shower fashionably is a wonderful way to express all by yourself and strengthen your self esteem. It lead to success in the areas, even an individual's professional together with personal daily life. However, way trends improve quickly. It quite often feels impossible to maintain with any fast-paced.

wendy wood law 说:
2020年3月19日 19:15

If we're able to accept every one possibilities exist in the present moment and additionally remain focused on the Now about life, consciously giving the Law regulations of Lifespan to overtly operate with us, we'd soon notice that we are produced in a co-created country which there is personal guilt for driving into your life.

star lite shopping m 说:
2020年3月19日 19:15

This is about the most misunderstood Laws about Life because the belief every one events really are predestined to make sure you transpire because of the some original action. It's always true from standpoint about action-reaction which usually expectations about future parties should choose fruition any time no optional adjustments are intended, simply given that the root reason was set in motion.

shopping batalha 说:
2020年3月19日 19:16

Whether you can be shopping just for food, wine bottles, clothing, or any other thing, British Columbia offer many of what can compliment anyone's tends to be. Since BC is mostly a large land, often sometimes referred to as the "sunshine coast", it also is certainly about the most culturally several places you can discover anywhere.

elimperio travel 说:
2020年3月19日 19:16

Traveling is a marvellous hobby for most people across the globe. This equally provides many different advantages to make sure you people. Here's as to why traveling is really important.

travelling 2 peru 说:
2020年3月19日 19:19

Driving also may make lifelong remembrance. Whether individuals travels by yourself or using family and friends, the feel certainly gives you him/her excellent and heart stopping stories, which he/she can share with people home. A wonderful long christmas with special loved one allows him/her to have some superior quality time around with them, which consecutively, benefits to make sure you renew and additionally restore friendships and makes quite strong one-to-one and additionally family provides.

full time maids in d 说:
2020年4月28日 18:58

In case you are recruiting servant maid via an agency, verify its trustworthiness, referrals regarding current consumers, about their particular maid's plans, how long they may be doing ecommerce etc. Ask if they guarantee their particular servants and if they performed any criminal record checks on their particular maids.

painting company in 说:
2020年4月28日 18:58

Alternatively, if you determine to go one other route and also hire residence painters; you are not required to be able to lift an individual finger. Professionals can do the do the job, of course so long as you pay these considerably. Painters will make certain that everything is completed according to meet your needs and would like.

cleaning company dub 说:
2021年6月06日 20:31

What is more, high-traffic zones like pools and loos require even more attention ın comparison to the other parts of the house. With pro guidance, cleaning every last edge of the home can get easily monitored. But, dependant upon the size for and types of the commercial building, the maintenance approach may perhaps vary now and then. So, now let’s look into the maintenance hacks that can be approved by way of the veteran house cleaning experts.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter
Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee