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. Hive进阶_Hive的表连接

    等值连接 select e.empno, d.deptno from emp e, dept d where e.deptno=d.deptno; 不等值连接 select e.empno, e.en ...

  2. CSS——三种页面引入方法

    目的:为了把样式和内容分开,并且使网页元素更加丰富,引入了CSS CSS页面引入有三种方式: 1)内联式:比较不常用,因为内容和样式仍然在一起,不方便.示例: <!DOCTYPE html> ...

  3. SpringBoot---Web开发

    一.概述 1.SpringBoot提供了spring-boot-starter-web为 web开发 予以支持: 2.spring-boot-starter-web提供了 内嵌的Tomcat 以及 S ...

  4. STM32空闲中断

    收发共存的思路没有经过验证!!! 空闲中断:既可以用来作为不定长接收数据帧的断帧判断/特别是DMA数据的接收,也可以用来指示中断发送的结束. 在需要发送的地方USART_ITConfig(UART5, ...

  5. 微服务实践分享(2)api网关

    1.作用[http://chuansong.me/n/465796751848]: 一个完整的.「面向接入」的API GW需要包含以下功能: 面向运行期 对客户端实现身份认证 通信会话的秘钥协商,报文 ...

  6. c#线程倒计时器源码

    using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threa ...

  7. text-transform字母大小写属性设置

    text-transform: none: 默认  不设置,全是小写 capitalize: 每个单词以大写字母开头 uppercase: 全部是大写字母 lowercase:  全部是小写字母 in ...

  8. ThreadLocal(关于struts2的ThreadLocal,实际上Jdk1.2就有了)

    ThreadLocal是通过在不同线程中操作变量的副本,来达到线程安全的目的,是用空间资源换时间资源的方式.今天在看struts2源码的时候,发现ActionContext中,就持有一个静态的Thre ...

  9. ECSHOP 商品增加新字段的方法

    在ecshop二次开发工作中,经常碰到一些ECSHOP高级使用者问我,如何给商品增加一个新字段,来录入一些新的内容. 下面我们结合ecshop后台“商品编辑”.“商品录入”来谈谈如何给ecshop商品 ...

  10. 一键部署WordPress开源内容管理系统

    https://market.azure.cn/Vhd/Show?vhdId=9857&version=10889 产品详情 产品介绍WordPress是一款个人博客系统,并逐步演化成一款内容 ...