全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 MATLAB等数学软件专版
15312 14
2011-06-06
我现在有一组数据,我想知道它是不是服从uniform distribution的,请问这如何在matlab里实现啊?我看了 kstest,默认的One-sample Kolmogorov-Smirnov test是测试 standard normal cdf的,请问如何应用于均匀分布呢?
另外,matlab里好像没有AD test,请问在哪儿能找到做ad  test 的代码呢?

谢谢
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2011-6-7 09:47:54
试试卡方检验吧 chi2gof 自己做个uniform distribution的分布函数就OK了
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-6-7 10:37:10
朋友,你给我发的消息我看到了。不过没看全,最近好像“短消息”老时无法读完。不过找到你这里的程序提问。
我还没看,也暂时还没有答案。
Kolmogorov-Smirnov test 。这个检验,应该不止只是能检验是否时标准正态分布吧?比如还有一些统计图;
Q-Q plot .这个就是我们说的 Q-Q 图。

kolmogorov  是现代概率公里理论的奠基人。概率论的几大公理,都是以他的名字命名。呵呵,扯远了。
你也问的比较细致了。
你说系统给的 K-S test 是  one sample 的。那么你需要其他的,好像条件时  均匀分布的检验。如果时这样,我建议你继续在看看系统手册。
doc kstest
然后看看里面参数的说明,通常这些函数的调用都有很大的灵活性。比如 random 函数,后面加入一些参数,就可以产生不同的随机数,比如 random('Normal',100,1),这样的应该时产生标准正态分布随机数。而另一个参数较少的,就是叫正在随机数发生函数  randn(m,n) etc。不一而足。


我才起床,还没开始运行 MATLAB 。一会儿我也看看。
另外如果你需要其他的 kstest 的检验程序,应该在 Lesage 的 JPL7 里,检验程序中有超过一个维的检验程序。曾经看到过有一个叫 kstest2()  这样的函数。

先聊到这里,深入看过后再继续给你回复。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-6-7 10:39:16
对了,你说的 AD test 是什么?
系统自带的 Econometrics toolbox 里,有大量的经济学建模检验程序。
adf 检验的话,很简单,名字都很好记。叫    adftest()  ,还有  kpsstest  这样的检验函数。

至于基础的检验,比如你刚才说的 KS 这样的检验,在统计工具箱里。


你说的 AD test 是什么?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-6-7 16:22:00
kstest

One-sample Kolmogorov-Smirnov test
Syntax

h = kstest(x)
h = kstest(x,CDF)
h = kstest(x,CDF,alpha)
h = kstest(x,CDF,alpha,type)
[h,p,ksstat,cv] = kstest(...)

Description

h = kstest(x) performs a Kolmogorov-Smirnov test to compare the values in the data vector x to a standard normal distribution. The null hypothesis is that x has a standard normal distribution. The alternative hypothesis is that x does not have that distribution. The result h is 1 if the test rejects the null hypothesis at the 5% significance level, 0 otherwise.

The test statistic is:

where F(x) is the empirical cdf and G(x) is the standard normal cdf.

h = kstest(x,CDF) compares the distribution of x to the hypothesized continuous distribution defined by CDF, which is either a two-column matrix or a ProbDist object of the ProbDistUnivParam class or ProbDistUnivKernel class. When CDF is a matrix, column 1 contains a set of possible x values, and column 2 contains the corresponding hypothesized cumulative distribution function values G(x). If possible, define CDF so that column 1 contains the values in x. If there are values in x not found in column 1 of CDF, kstest approximates G(x) by interpolation. All values in x must lie in the interval between the smallest and largest values in the first column of CDF. If the second argument is empty ([]), kstest uses the standard normal distribution.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-6-7 16:28:29
h=kstest(x,CDF), 这个时一个参数。你的问题只需要这个检验。因为你就一个样本,想知道它服从均匀分布与否。
其中,一些调用不输入CDF 参数。要么就是  h=kstest(x).  这个函数的默认CDF 是 标准正态分布,检验时X这个样本服从 标准正态分布与否。

另外的调用是这样的。
[h,p,ksstat,cv] = kstest(x,[],alpha,type)
将第二个参数设置为空,也是代表是标准正态分布,手册里提示,要做是否服从标准正态分布,还有 liliktest 吧,这个拼写不一定正确。


我还没理解 CDF 这个参数怎么赋值。你问问论坛的其他人,因为我平时很少用 KSTEST 函数。


系统统计工具箱里,还有一个 KSTEST2 函数。是检验两个样本的分布是否一样。
比如有两个样本,分别为 X,Y 。
h=kstest2(x,y)
这样调用就可以。
我只能回答这么多了。不好意思。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群