置信区间的置信区间

I’m going to try something a little different today, in which I combine two (completely unrelated) topics I love talking about, and hopefully create something that is interesting and educational.

今天,我将尝试一些与众不同的东西,其中我结合了两个我喜欢谈论的主题(完全不相关),并希望创建一些有趣且具有教育意义的东西。

…Actually, scratch that. If you’ve ever read anything I’ve written on Medium, this is actually pretty on brand (Explaining Linear Regression to Michael Scott, anyone?) In today’s article, I am going to explain what confidence intervals are, how to calculate them, and how to interpret them — all through the use case of Harry Potter’s infamous Divination teacher.

…实际上,把它刮掉。 如果您曾经读过我在Medium上写过的任何文章,那么实际上这在品牌上是很​​不错的( 向Michael Scott解释线性回归 ,有人吗?)在今天的文章中,我将解释什么是置信区间,如何计算它们,以及如何解释它们-全部以哈利·波特臭名昭著的占卜老师为例。

For those of you who are unfamiliar with Harry Potter and Sybill Trelawney (which I’m assuming is nobody currently reading this, because it means you’ve been without internet for 20+ years), she is a witch who can “see into the future” through 99% educated guessing and 1% true prophecies. Confidence intervals, at least in my opinion, are pretty similar: making educated guesses about entire populations based on a small set of observations. However, instead of crystal balls and tea leaves, our tools are standard deviations and sample means.

对于不熟悉哈利·波特(Harry Potter)和西比尔·特劳拉尼(Sybill Trelawney)(我认为目前没有人读这本书,因为这意味着您已经有20多年没有互联网了)的那些人,她是一个巫婆,可以“观察未来”通过99%的有根据的猜测和1%的真实预言。 至少在我看来,置信区间非常相似:根据一小组观察结果对整个人群进行有根据的猜测。 但是,我们的工具不是标准的球和茶叶,而是水晶球和茶叶。

什么是置信区间,为什么人们使用它们? (What is a Confidence Interval, and Why do People Use Them?)

Professor Trelawney has had thousands of students during her tenure at Hogwarts, and Dumbledore is doing an audit of her work to see how accurate she really is at predicting the future. However, Dumbledore is a busy guy (trying to hunt down Horcruxes and run a school) and can’t reach out to every student who has ever taken Trelawney’s class. So instead, he randomly selects a sample of 300 previous students and asks them what percentage of her predictions have come true so far.

特里劳妮教授她在霍格沃茨任职期间,已经有成千上万的学生,和邓布利多正在做她的工作进行审核,看她真的是在预测未来如何准确。 但是,邓布利多是个忙碌的人(试图追捕Horcruxes并经营一所学校),无法接触到曾经参加过Trelawney课的每个学生。 因此,他取而代之的是,从300名以前的学生中随机选择一个样本,并询问他们到目前为止,她的预测中有多少百分比是正确的。

Left skewed distribution of Trelawney’s prediction accuracy. Image courtesy of author.
Trelawney的预测准确性的左偏分布。 图片由作者提供。

Dumbledore collects the responses and finds that the distribution of responses is left skewed, which means students are more likely to find Trelawney’s predictions to be inaccurate than accurate. In fact, the sample average is 55.6%, which means that Trelawney’s “predictions” are barely better than random guessing.

邓布利多收集了答案,发现答案的分布是偏斜的,这意味着学生更有可能发现Trelawney的预测是不准确的,而不是准确的。 实际上,样本平均值为55.6%,这意味着Trelawney的“预测”仅比随机猜测好。

This is pretty concerning to Dumbledore, because he does not want a teacher who is essentially guessing when they teach Divination. He wonders what the true mean accuracy of her predictions is, and if it might actually be lower than the sample mean of 55.6% if he had reached out to every student she ever taught.

对于邓布利多来说,这很令人担忧,因为他不希望有一位在教授占卜术时实质上在猜测的老师。 他想知道她的预测的真正平均准确度是多少,如果他接触过她曾经教过的每一个学生,那么它是否真的可能低于样本平均水平55.6%。

Luckily, Dumbledore remembers a Muggle concept called the Central Limit Theorem (what can I say, he’s a multifaceted guy), which gives him the ability to approximate the true mean accuracy of Trelawney’s predictions. The Central Limit Theorem posits that when you have a sample of data and you want to find the true population statistic (i.e. a common example is mean so I will use it in this article, but it can be other measures as well), you can take smaller groups of the sample and find their mean (i.e. random samples of 30 people at a time, when you have a total sample of 300 people and total population of 30,000 people). If you have enough samples and the samples fulfill certain criteria, the sample means will fall into a normal distribution (regardless of the original distribution of the data) and the mean of the sampling distribution of the sample mean (I hate statistics sometimes) will approximate the true population mean (the mean, if you had actually surveyed all 30,000 people in the population).

幸运的是,邓布利多记得一个麻瓜概念,即中心极限定理(我可以说,他是一个多面的人),这使他能够近似特雷劳尼的预测的真实平均准确度。 中心极限定理假设,当您有数据样本并想要找到真实的总体统计量时(即,一个普通的例子是平均值,因此我将在本文中使用它,但也可以是其他度量),您可以取较小的样本组并找到平均值(即,当您的样本总数为300人且总人口为30,000人时,一次随机抽样30人)。 如果您有足够的样本,并且样本满足某些条件,则样本均值将落入正态分布(无论数据的原始分布如何),并且样本均值的采样分布均值 (有时会讨厌统计)真实人口均值(均值,如果您实际调查了人口中的所有30,000个人)。

Analytics VidhyaAnalytics Vidhya提供

Based on this concept, Dumbledore knows that the 55.6% average accuracy is somewhere on the normally distributed curve of sample means, and the true accuracy is in the middle of this same distribution.

基于这样的理念,邓布利多知道,55.6%的平均准确度是某处的样本均值的正态分布曲线上,而真正的精度在这相同的分布的中间。

They should get me for textbook infographics, honestly. O’Reilly HMU. Image courtesy of author (because who else would make this LOL).
老实说,他们应该让我获得教科书信息图表。 O'Reilly HMU。 图片由作者提供(因为还有其他人制作此LOL)。

However, he still doesn’t know exactly where the sample mean lies on the distribution, and how close it is to the actual population mean (denoted as μ). This is where confidence intervals come in.

但是,他仍然不知道样本均值在分布上的确切位置以及它与实际总体均值(表示为μ )有多接近。 这就是置信区间的来源。

Confidence intervals create an interval of standard deviations centered around the sample mean. Based on the size of the interval, you can declare that the interval will include the true population mean x% of the time. Many researchers and companies use 95% confidence intervals (span 2 standard deviations away from the sample mean on each side), but based on your use case, you can go higher or lower in confidence (i.e. 3 standard deviations away from the mean is 99.7% confidence).

置信区间创建一个以样本平均值为中心的标准偏差区间。 根据时间间隔的大小,您可以声明时间间隔将包括x时间的真实总体平均值。 许多研究人员和公司都使用95%的置信区间(距样本均值2个标准偏差),但是根据您的用例,您可以提高或降低置信度(即距均值3个标准偏差为99.7) % 置信度)。

Examples of what a 95% confidence interval would look like, for 4 different means on the distribution of the sample mean. Light purple represents values that would be included in a 95% confidence interval centered around each sample mean. Dark purple lines represent 2 standard deviations from the theoretical population mean.
对于样本均值分布的4种不同均值,95%置信区间应为什么样的示例。 浅紫色表示将包含在以每个样本平均值为中心的95%置信区间中的值。 深紫色线表示与理论总体平均值的2个标准偏差。

Based on the example above, you can see how sample means that fall within 2 standard deviations of the population mean (inside the dark purple lines) will include the population mean (dotted blue line) in their 95% confidence interval. However, the sample means that are located more than 2 standard deviations from the population mean will not include the population mean in their confidence interval.

根据上面的示例,您可以看到样本如何表示落入总体平均值的 2个标准偏差(深紫色线内)将在其95%置信区间内包括总体平均值(蓝色虚线)。 但是,样本均值与总体均值的差超过2个标准差时,不会在其置信区间内包括总体均值。

Since 95% of the values in a normal distribution reside within 2 standard deviations from the mean, we can be confident that 95% of the sample means will be within 2 standard deviations from the population mean. Following this, we can also say that 95% of all random samples taken from this population will include the true population mean in their 95% confidence interval.

由于正态分布中95%的值位于均值的2个标准差之内,因此我们可以确信95%的样本均值将与总体均值在2个标准差之内。 之后,我们还可以说, 从该总体中抽取的所有随机样本中95%将在其95%置信区间内包含真实总体平均值

如何计算置信区间 (How to Calculate a Confidence Interval)

Now that we have a general idea of what confidence intervals are used for and why they work, we can return to Hogwarts and help Dumbledore calculate the confidence interval for Professor Trelawney’s prediction accuracy.

既然我们对所用的置信区间及其工作原理有了一个大致的了解,我们可以返回霍格沃茨,并帮助邓布利多计算特雷劳尼教授的预测准确性的置信区间。

Statistics How To统计局提供

Above is the generic formula for calculating a confidence interval, where is the sample mean, z is the number of standard deviations from the mean we want the interval to span, s is the standard deviation of the sample, and n is the number of samples in the group.

上面是计算置信区间的通用公式,其中是样本均值, z是相对于我们希望区间跨越的均值的标准偏差数, s是样本的标准差, n是样本数的标准差。组中的样本。

The second half of the formula ( z * s / √n) calculates the actual value of what z standard deviations are (z = 2 for 95% confidence interval), and you add and remove this value from to find the upper and lower bound of your confidence interval.

公式的后半部分(z * s /√n)计算z标准差的实际值(对于95%置信区间, z = 2),然后从x̅中添加和删​​除该值以找到 置信区间的上限和下限。

If Dumbledore plugs in the assessment values into this formula, he will get:

如果Dumbledore将评估值插入此公式,他将得到:

Upper-bound

上限

= 55.6 + (2 x (12.9/√300)

= 55.6 +(2 x(12.9 /√300)

= 57.08%

= 57.08%

Lower-bound

下界

= 55.6 - (2 x (12.9/√300)

= 55.6-(2 x(12.9 /√300)

= 54.12%

= 54.12%

This means there is a good chance the true accuracy of Professor Trelawney’s prediction is between 54.12% — 57.08%. However, since Dumbledore only assessed one sample, we cannot say if this sample average (55.6%) was within 2 standard deviations of the population mean, and if its confidence interval successfully captured the true population average. There is a chance the sample average happened to be in the 5% of data that is > 2 standard deviations from the mean (aka one of the BAD BOIS in red below), and therefore completely missed the population mean.

这意味着特雷劳尼教授的预测的真实准确性很有可能在54.12%— 57.08%之间 。 但是,由于Dumbledore仅评估了一个样本,因此我们无法确定该样本平均值(55.6%)是否在总体均值的2个标准差之内,以及其置信区间是否成功捕获了真实总体均值。 样本平均值有可能在数据的5%内,与平均值相差> 2个标准差(也就是下面的红色中的BAD BOIS之一),因此完全错过了总体平均值。

MIT, annotations by yours truly.MIT提供 ,并由您真正注释。

特雷劳尼教授的命运(又名邓布利多的下一步) (Professor Trelawney’s Fate (aka Dumbledore’s next steps))

Dumbledore has a few options for next steps:

邓布利多有几个可供选择的下一步:

  1. He can send out the survey to a few more cohorts of 300 students each, and start plotting the cohort averages in a distribution. This will give him a better idea of where the 55.6% falls (i.e. close to the other values and likely within 2 standard deviations of the population mean, or significantly further from the other values and likely > 2 standard deviations).他可以将调查问卷发送给另外300个学生的队列,然后开始在分布中绘制队列平均值。 这将使他更好地了解55.6%的下降位置(即接近其他值,并且可能在总体均值的2个标准差内,或者比其他值明显更远,并且可能大于2个标准差)。
  2. He can re-run the same analysis, this time taking smaller groups out of his 300 responses and plotting their means in a distribution (i.e. 100 random groups of 30 students each, with replacement). The mean of this distribution will give him a good idea of what the actual population mean is, without needing to use a confidence interval. A sample size of 30 (n=30) is the “rule-of-thumb” for the theorem of central tendency to work well, so Dumbledore actually went above and beyond with his original sample size of 300.他可以重新运行相同的分析,这次将他的300个响应中的较小的组从中抽取出来,并在分布中绘制平均值(即100个随机组,每组30个学生,并有替换)。 该分布的平均值将使他对实际总体的平均值有一个很好的了解,而无需使用置信区间。 样本大小为30(n = 30)是中心趋势定理很好的“经验法则”,因此邓布利多实际上超过了他最初的样本大小300。

Dumbledore considers his options, and decides to accept the confidence interval of 54.12% — 57.08% prediction accuracy for now. He is not terribly thrilled with the results, but he is relieved to see that the lower-bound of the interval is still greater than 50%, which means — at the very least — Professor Trelawney’s predictions are better than random guessing!

邓布利多考虑了自己的选择,决定暂时接受54.12%的置信区间-57.08%的预测准确度。 他对结果并不感到非常兴奋,但看到该区间的下限仍然大于50%感到欣慰,这意味着-至少-至少,Trelawney教授的预测比随机猜测要好!

He has summarized his findings, and will present them to Pressor Trelawney in her next performance review. Maybe he will recommend for her to add confidence intervals to her to her syllabus in the coming years

置信区间的置信区间_什么是置信区间,为什么人们使用它们?相关推荐

  1. 95%置信区间的含义_在一定的置信度下(如95%)请解释置信区间的含义

    置信区间分作数学期望 μ 的置信区间,标准差 σ 的置信区间,方差 σ^2 的置信区间等等. 置信区间的意义,是以样本的参数推测总体的参数. 比如用样本的平均值 X▔,推导出总体的数学期望 μ 的分布 ...

  2. 95%置信区间的含义_如何理解 95% 置信区间?

    置信区间,就是一种区间估计. 先来看看什么是点估计,什么是区间估计. 1 点估计与区间估计 以前很流行一种刮刮卡: 游戏规则是(假设只有一个大奖):大奖事先就固定好了,一定印在某一张刮刮卡上 买了刮刮 ...

  3. 95%置信区间的含义_总体均数的95%置信区间的含义是

    总体均数的95%置信区间的含义是 答:每100个样本含量相同样本,平均95个根据样本信息所得的区间包含总体均数 王道政治是一种"好人政治" 答:√ 中国大学MOOC: 清代福建客家 ...

  4. 置信系数 表达了置信区间的计算_参数估计05---置信区间, 置信限

    区间估计 引言 前面,我们讨论了参数点估计.它是用样本算得的一个值去估计未知参数.但是,点估计值仅仅是未知参数的一个近似值,它没有反映出这个近似值的误差范围,使用起来把握不了.区间估计正好弥补了点估计 ...

  5. python笔记:6.2.1.3单总体比例参数估计_计算合格率置信区间(例6-3)

    # -*- coding: utf-8 -*- """ Created on Wed Jun 19 14:12:25 2019@author: User "&q ...

  6. 95%置信区间的含义_怎样全面理解95%置信区间

    前文我们解释了正态分布和抽样分布,今天终于要开始讲解置信区间了.有不少小伙伴在后台留言希望多讲讲假设检验和置信区间的内容,在此对同学们的关注表示感谢,同时,我们也会尽力加快推文速度. 首先,简单回顾一 ...

  7. r语言C指数的置信区间,R语言入门:均值置信区间

    一.问题 有来自群体的样本.根据样本推断该群体均值的置信区间. 二.解决方案 用t.test函数处理样本x: 代码 > t.test(x) 函数的输出包括95%可信度的置信区间.可以用conf. ...

  8. 图例放在图的外面_手把手教你绘制多个置信区间的森林图

    森林图的历史可以追溯到20世纪70年代,最常用于Meta分析中.forestplot包是绘制森林图的R包,其起源于rmeta包的forestplot函数,解决了forestplot函数的一些缺点,功能 ...

  9. [统计]_通俗地讲置信区间

    这是之前发在个人公众号上的文章,希望能对读者有帮助. 今天我们谈谈置信区间,可能很多初学者看到置信区间感觉都看不懂,因为书上并没有直接定义置信区间,只说了什么是95%的置信区间,而且说的也很费解,对9 ...

  10. 深度解析机器学习中的置信区间(附代码)

    作者:Jason Brownlee 翻译:和中华 校对:丁楠雅 本文约4000字,建议阅读15分钟. 本文介绍了置信区间的概念以及如何计算置信区间和bootstrap置信区间. 机器学习很多时候需要估 ...

最新文章

  1. oracle本地连接地址,关于Oracle本地连接出现与监听有关的问题的解决方法探讨,oracle本地连接...
  2. CMOS及CCD感光sensor的主要技术参数解析
  3. Ghost 系统的过程
  4. 匿名类java的说明_Java8 Lambdas与匿名类
  5. python中matrix是什么意思_Python的基础语法
  6. rust的权限柜怎么做_潍坊装修知识~二胎家庭不做上下铺,把两张床靠墙放,中间做收纳柜,你感觉怎么样?...
  7. spring整合springmvc案例
  8. oracle临时表空间组,证明临时表空间组在并发session时的作用
  9. java点赞功能实现_JavaWeb中点赞功能的实现及完整实例
  10. 什么样的程序猿,最容易被鄙视?
  11. 08.28 JavaScript 边界 选择修饰符 模式单元 修饰符 正则的使用
  12. 函数adapthisteq
  13. linux内核启动地址的确定
  14. 机器学习笔记【一】- 线性回归(末):统计学推导以及局部加权线性回归算法实例
  15. MATLAB基本操作之画图
  16. Cotherm 多物理场耦合方案
  17. 由浅入深学java pdf_由浅入深学Java:基础、进阶与必做260题 PDF_IT教程网
  18. 抖音算法机制,抖音算法规则,抖音算法逻辑
  19. send message
  20. 特斯拉与Uber达成协议,为Uber伦敦司机提供电动汽车

热门文章

  1. 微信声音锁会上传到服务器吗,微信声音锁安全吗?微信声音锁可以换吗?
  2. 蜀门linux服务端架设,蜀门1296LINUX私服服务端(红旗6架设视频+工具)
  3. java list下标_java8 stream根据下标分组
  4. 关于JavaScript打印去掉页眉页脚
  5. 计算机视觉与机器学习之6σ问题
  6. python 情感分析实例_使用python+机器学习方法进行情感分析(详细步骤)
  7. 倪光南院士:网络安全和信息化要同步推进
  8. 在div中加本地html,div加载另一个HTML页面
  9. 本科学经济还是学数学和计算机,如果考研想往经管类方向,学习数学类,还是数学与应用数学, 这两个专业有什么不同...
  10. android恢复短信中心号码,短信中心号码设置解决安卓手机不能发短信问题,教你设置解决异地发不了短信问题...