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. 首次开发H5长图页总结

    首次开发H5长图页总结. 资源统一加载 资源统一加载, 分开获取 定义资源标识符 在src/resources目录下 定义各个资源模块. 在Asset.js中获取定义好的所有模块, 循环出具体的文件路 ...

  2. F. Coprime Subsequences 莫比乌斯反演

    http://codeforces.com/contest/803/problem/F 这题正面做了一发dp dp[j]表示产生gcd = j的时候的方案总数. 然后稳稳地超时. 考虑容斥. 总答案数 ...

  3. (转)linux dumpe2fs命令

    linux dumpe2fs命令 命令名称 dumpe2fs - 显示ext2/ext3/ext4文件系统信息. dumpe2fs命令语法 dumpe2fs [ -bfhixV ] [ -o supe ...

  4. Main函数中的参数argc,argv的使用简单解析

    本篇文章是对Main函数中的参数argc,argv的使用进行了简单的分析介绍,需要的朋友参考下: C/C++语言中的main函数,经常带有参数argc,argv,如下:  int main(int a ...

  5. clickhouse源码Redhat系列机单机版安装踩坑笔记

    前情概要 由于工作需要用到clickhouse, 这里暂不介绍概念,应用场景,谷歌,百度一大把. 将安装过程踩下的坑记录下来备用 ClickHouse源码 git clone安装(直接下载源码包安装失 ...

  6. C#入门笔记3 表达式及运算符2

    关系运算符,也称布尔比较运算符 注:var1为bool类型,var2与var3可以是其它类型.[数据类型看下一节] 运算符 类别 示例表达式 结果说明 == 二元 var1=var2==var3 如果 ...

  7. 关于下载文件封装的两个类(Mars)

    首先是文件FileUtils.java package mars.utils; import java.io.File; import java.io.FileOutputStream; import ...

  8. 阿里开发搜索(OpenSearch)的学习与使用

    概述: 开放搜索(OpenSearch)是一款结构化数据搜索托管服务,为移动应用开发者和网站站长提供简单.高效.稳定.低成本和可扩展的搜索解决方案. OpenSearch基于阿里巴巴自主研发的大规模分 ...

  9. HTML视频简介

    此文章复制原来文章,原网址是https://www.html5rocks.com/zh/tutorials/video/basics/#toc-encode 简介 视频标记是 HTML5 功能中备受关 ...

  10. pc端常见布局---水平居中布局 单元素定宽

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...