Ref:https://onlinecourses.science.psu.edu/stat464/print/book/export/html/14


估计CDF

The Empirical CDF

绘制empirical cdf的图像:

x = c(4, 0, 3, 2, 2)
plot.ecdf(x)

Kolmogorov-Smirnov test

testing the "sameness" of two independent samples from a continuous distribution

大的p-value可以说明不同,但小的p-value不能说明相同

样本数量较小时,p-value可能偏大

> x = c(4, 0, 3, 2, 2)
> plot.ecdf(x)
> plot(ecdf(x))
> ecdf(x)
Empirical CDF
Call: ecdf(x)
x[1:4] = 0, 2, 3, 4
> ks.test(x, y="pnorm", mean(x), sd(x)) One-sample Kolmogorov-Smirnov test data: x
D = 0.24637, p-value = 0.9219
alternative hypothesis: two-sided Warning message:
In ks.test(x, y = "pnorm", mean(x), sd(x)) :
Kolmogorov - Smirnov检验里不应该有连结

Ps:

在R中,与正态分布相关的有四个函数。dnorm是pdf,pnorm是cdf,qnorm是the inverse cumulative density function (quantiles)

rnorm是randomly generated numbers

关于qnorm,它给定一个概率,返回cdf对应的值。如果使用标准正态分布的,那么给定一个概率,返回的就是Z-score

dnorm(x, mean = 0, sd = 1, log = FALSE)
pnorm(q, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE)
qnorm(p, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE)
rnorm(n, mean = 0, sd = 1)

Density Estimation  

> x
[1] 4 0 3 2 2
> density(x) Call:
density.default(x = x) Data: x (5 obs.); Bandwidth 'bw' = 0.4868 x y
Min. :-1.4604 Min. :0.001837
1st Qu.: 0.2698 1st Qu.:0.059033
Median : 2.0000 Median :0.141129
Mean : 2.0000 Mean :0.144277
3rd Qu.: 3.7302 3rd Qu.:0.205314
Max. : 5.4604 Max. :0.351014
> plot(density(x))

如果在density(x)里面加上bandwidth参数,那么图片会发生变化,如上图所示。

  

  

Applied Nonparametric Statistics-lec10的更多相关文章

  1. Applied Nonparametric Statistics-lec9

    Ref:https://onlinecourses.science.psu.edu/stat464/print/book/export/html/12 前面我们考虑的情况是:response是连续的, ...

  2. Applied Nonparametric Statistics-lec8

    Ref:https://onlinecourses.science.psu.edu/stat464/print/book/export/html/11 additive model value = t ...

  3. Applied Nonparametric Statistics-lec7

    Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/9 经过前面的步骤,我们已经可以判断几个样本之间是否 ...

  4. Applied Nonparametric Statistics-lec6

    Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/8 前面都是对一两个样本的检查,现在考虑k个样本的情 ...

  5. Applied Nonparametric Statistics-lec5

    今天继续two-sample test Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/6 Mann ...

  6. Applied Nonparametric Statistics-lec4

    Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/5 Two sample test 直接使用R的t- ...

  7. Applied Nonparametric Statistics-lec3

    Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/4 使用非参数方法的优势: 1. 对总体分布做的假设 ...

  8. Applied Nonparametric Statistics-lec2

    Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/3 The Binomial Distributio ...

  9. Applied Nonparametric Statistics-lec1

    参考网址: https://onlinecourses.science.psu.edu/stat464/node/2 Binomial Distribution Normal Distribution ...

随机推荐

  1. Netty(1-1)Discard

    一.DiscardServerHandler import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext ...

  2. RabbitMQ使用教程(二)RabbitMQ用户管理,角色管理及权限设置

    上一篇博客 RabbitMQ使用教程(一)RabbitMQ环境安装配置及Hello World示例 中,我们成功的安装好了RabbitMQ环境,并通过一个Java客户端示例了解了用生产者来发布消息,用 ...

  3. IIS访问网站出错[要求输入用户名密码]的解决方案

    症状: 1.HTTP 500 - 内部服务器错误 2.您不具备使用所提供的凭据查看该目录或页的权限 3.基于所提供的凭据,您没有权限查看此目录或网页.HTTP 错误 401.3 - 访问被资源 ACL ...

  4. 判断浏览器是pc端还是移动端

    var browser = { versions: function() { var u = navigator.userAgent, app = navigator.appVersion; retu ...

  5. Android 虚拟导航挡住应用底部解决方案(屏幕底部的三个按键)

    我在华为P6测试机上测试,发现底部的三个虚拟按钮遮挡了我的应用.类似效果如:https://www.zhihu.com/question/35292413#answer-28473700 解决方案 在 ...

  6. excel如何显示多个独立窗口

    https://blog.csdn.net/tigaobansongjiahuan8/article/details/76861084

  7. 轮播插件unslider.min.js使用demo

    有两种应用方式: 1.轮播图片作为<img>标签使用 HTML代码: <html> <head> <meta charset="utf-8" ...

  8. 利用jieba第三方库对文件进行关键字提取

    已经爬取到的斗破苍穹文本以TXT形式存储 代码 import jieba.analyse path = 'C:/Users/Administrator/Desktop/bishe/doupo.text ...

  9. ansys-表格

    转自http://blog.sina.com.cn/s/blog_833dee820102xwb3.html ANSYS中表格数组的定义及使用举例 ANSYS中会有许多的参数数据,这些参数的形成后要放 ...

  10. iOS开发笔记--关于 @synchronized,这儿比你想知道的还要多

    http://www.cocoachina.com/ios/20151103/14007.html 本文翻译自 Ryan Kaplan 的 More than you want to know abo ...