辛普森悖论_所谓的辛普森悖论

2023-11-18

辛普森悖论

We all know the Simpsons family from Disneyland, but have you heard about the Simpson’s Paradox from statistic theory? This article will illustrate the definition of Simpson’s Paradox with an example, and show you how can it harm your statistical tests and analysis.

我们都知道迪斯尼乐园的辛普森一家,但您是否从统计理论中听说过辛普森悖论? 本文将通过一个示例说明Simpson's Paradox的定义,并向您展示它如何危害您的统计测试和分析。

What is Simpson’s Paradox?

什么是辛普森悖论?

Simpson’s paradox refers to the situations in which a trend or relationship that is observed within multiple groups disappears or reverses when the groups are combined. The quick answer to why there is Simpson's paradox is the existence of confounding variables. I will illustrate it with the example below.

辛普森悖论是指当组合在一起时,在多个组中观察到的趋势或关系消失或逆转的情况。 为何存在辛普森悖论的快速答案是存在混杂变量。 我将通过以下示例进行说明。

An example of Simpson’s Paradox

辛普森悖论的一个例子

Let’s take a simple example from a study analyzing the mortality rate difference between smokers and non-smokers, which was conducted by Appleton, French, and Vanderpump in 1996. Here is the data they have collected in the study:

让我们举一个简单的例子,该研究是由Appleton,French和Vanderpump于1996年进行的一项分析吸烟者和非吸烟者之间的死亡率差异的研究。以下是他们在研究中收集的数据:

the mortality rate for smokers and non-smokers
吸烟者和非吸烟者的死亡率

One would expect the mortality rate to be higher for smokers compared to non-smokers due to the harm caused by smoking. However, the data shows that the mortality rate is higher for non-smokers. The relationship is better represented here:

人们会认为,由于吸烟造成的危害,与不吸烟者相比,吸烟者的死亡率更高。 但是,数据显示,非吸烟者的死亡率较高。 该关系在这里可以更好地表示:

mortality rate chart
死亡率表

The grey line in the chart represents the mortality rate, and it is higher for non-smokers. Why is that? Let’s bring down the data into multiple groups by ages:

图表中的灰线代表死亡率,非吸烟者死亡率更高。 这是为什么? 让我们按年龄将数据分为多个组:

Here is the chart plotting the mortality rate by age groups and by smoking or not:

这是按年龄组和吸烟与否绘制死亡率的图表:

The chart shows that in the dataset, the mortality rate increase as age increases for both smokers and non-smokers. It is reasonable to conclude that age is positively correlated with the mortality rate, no matter by the evidence from this data, or from common sense.

图表显示,在数据集中,吸烟者和非吸烟者的死亡率都随着年龄的增长而增加。 可以合理地得出结论,无论是根据该数据还是常识,年龄与死亡率呈正相关。

In the meantime, if we compare the smoking rate across different age groups, as the chart presented below:

同时,如果我们比较不同年龄段的吸烟率,如下图所示:

There are more smokers than non-smokers for all age groups except 65–74, and 75+. 27% of the non-smokers are older than 65, and only 8% of the smokers are older than 65. Thus, the chart shows that the age distributions are substantially different between smokers and non-smokers. The smoking population is younger than the non-smoking population from the data. In other words, age is negatively correlated with the probability of being in the smoking group or not.

除了65-74岁和75岁以上的年龄段外,所有年龄段的吸烟者都比不吸烟者多。 27%的不吸烟者年龄在65岁以上,只有8%的吸烟者年龄在65岁以上。因此,图表显示,吸烟者与不吸烟者之间的年龄分布存在很大差异。 根据数据,吸烟人口比非吸烟人口年轻。 换句话说,年龄与是否参加吸烟组负相关。

The previous evidence supports the statement that when we examine the relationship between smoking and mortality rate, we cannot ignore age, which is called a confounding variable(or a lurking variable). Age is positively correlated with mortality rate but is negatively correlated with smoking. Older groups have a higher mortality rate, but fewer of them are smokers. Thus, a greater proportion of older non-smokers, with a 100% mortality rate in this dataset, pushes up the average mortality rate for the non-smoker group. That is why we observe that the mortality rate is lower for the non-smokers across all age groups, but it is higher in the non-smoker group when we combine all groups together. This example perfectly illustrates what is Simpson’s Paradox, and why it happens.

先前的证据支持这样的说法:当我们检查吸烟与死亡率之间的关系时,我们不能忽略年龄,这被称为混杂变量(或潜伏变量)。 年龄与死亡率呈正相关,但与吸烟呈负相关。 年龄较大的人群死亡率较高,但吸烟者较少。 因此,在此数据集中具有较高死亡率的年龄较大的不吸烟者比例为100%,从而推高了不吸烟者群体的平均死亡率。 这就是为什么我们观察到所有年龄段的不吸烟者的死亡率都较低,但将所有年龄段的人群合并在一起,则不吸烟者的死亡率较高。 这个例子完美地说明了什么是辛普森悖论,以及它为什么发生。

How to deal with Simpson’s Paradox?

如何应对辛普森悖论?

Now we know what and why, it is time to know how to fix it. Simpson’s Paradox can cause great harm for statistical analyses or tests because of the reversed or insignificant relationship when ignoring the confounding variables. Thus, the way to deal with Simpson’s Paradox is to find the confounding variable and control it during your analysis. Take the previous data as an example, you cannot jump to the conclusion that non-smokers have a higher mortality rate thus smoking is good for health, when you are only observing the results from group averages. Breaking down the data into different age groups will give you a better understanding of the relationship.

现在我们知道了什么以及为什么,现在该知道如何修复它了。 辛普森悖论可能会给统计分析或测试造成极大伤害,因为当忽略混淆变量时,它们之间的关系相反或无关紧要。 因此,处理辛普森悖论的方法是找到混淆变量,并在分析过程中对其进行控制。 以以前的数据为例,当您仅观察小组平均值的结果时,您无法得出结论,即非吸烟者的死亡率较高,因此吸烟有益于健康。 将数据分为不同年龄段可以使您更好地了解这种关系。

Hope this article helps you understand Simpson’s Paradox. Thank you for reading!

希望本文能帮助您理解辛普森悖论。 感谢您的阅读!

翻译自: https://medium.com/the-innovation/the-so-called-simpsons-paradox-6d0efdca6fdc

辛普森悖论

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

辛普森悖论_所谓的辛普森悖论 的相关文章

  • 保存为 HDF5 的图像未着色

    我目前正在开发一个将文本文件和 jpg 图像转换为 HDF5 格式的程序 用HDFView 3 0打开 似乎图像仅以灰度保存 hdf h5py File Sample h5 img Image open Image jpg data np
  • 为什么从 Pandas 1.0 中删除了日期时间?

    我在 pandas 中处理大量数据分析并每天使用 pandas datetime 最近我收到警告 FutureWarning pandas datetime 类已弃用 并将在未来版本中从 pandas 中删除 改为从 datetime 模块
  • Python getstatusoutput 替换不返回完整输出

    我发现了这个很棒的替代品getstatusoutput Python 2 中的函数在 Unix 和 Windows 上同样有效 不过我觉得这个方法有问题output被构建 它只返回输出的最后一行 但我不明白为什么 任何帮助都是极好的 def
  • 需要在python中找到print或printf的源代码[关闭]

    很难说出这里问的是什么 这个问题是含糊的 模糊的 不完整的 过于宽泛的或修辞性的 无法以目前的形式得到合理的回答 如需帮助澄清此问题以便重新打开 访问帮助中心 help reopen questions 我正在做一些我不能完全谈论的事情 我
  • 删除flask中的一对一关系

    我目前正在使用 Flask 开发一个应用程序 并且在删除一对一关系中的项目时遇到了一个大问题 我的模型中有以下结构 class User db Model tablename user user id db Column db String
  • 独立滚动矩阵的行

    我有一个矩阵 准确地说 是 2d numpy ndarray A np array 4 0 0 1 2 3 0 0 5 我想滚动每一行A根据另一个数组中的滚动值独立地 r np array 2 0 1 也就是说 我想这样做 print np
  • datetime.datetime.now() 返回旧值

    我正在通过匹配日期查找 python 中的数据存储条目 我想要的是每天选择 今天 的条目 但由于某种原因 当我将代码上传到 gae 服务器时 它只能工作一天 第二天它仍然返回相同的值 例如当我上传代码并在 07 01 2014 执行它时 它
  • 如何通过索引列表从 dask 数据框中选择数据?

    我想根据索引列表从 dask 数据框中选择行 我怎样才能做到这一点 Example 假设我有以下 dask 数据框 dict A 1 2 3 4 5 6 7 B 2 3 4 5 6 7 8 index x1 a2 x3 c4 x5 y6 x
  • pyspark 将 twitter json 流式传输到 DF

    我正在从事集成工作spark streaming with twitter using pythonAPI 我看到的大多数示例或代码片段和博客是他们从Twitter JSON文件进行最终处理 但根据我的用例 我需要所有字段twitter J
  • 加快网络抓取速度

    我正在使用一个非常简单的网络抓取工具抓取 23770 个网页scrapy 我对 scrapy 甚至 python 都很陌生 但设法编写了一个可以完成这项工作的蜘蛛 然而 它确实很慢 爬行 23770 个页面大约需要 28 小时 我看过scr
  • pip 列出活动 virtualenv 中的全局包

    将 pip 从 1 4 x 升级到 1 5 后pip freeze输出我的全局安装 系统 软件包的列表 而不是我的 virtualenv 中安装的软件包的列表 我尝试再次降级到 1 4 但这并不能解决我的问题 这有点类似于这个问题 http
  • Python3 在 DirectX 游戏中移动鼠标

    我正在尝试构建一个在 DirectX 游戏中执行一些操作的脚本 除了移动鼠标之外 我一切都正常 是否有任何可用的模块可以移动鼠标 适用于 Windows python 3 Thanks I used pynput https pypi or
  • import matplotlib.pyplot 给出 AttributeError: 'NoneType' 对象没有属性 'is_interactive'

    我尝试在 Pycharm 控制台中导入 matplotlib pyplt import matplotlib pyplot as plt 然后作为回报我得到 Traceback most recent call last File D Pr
  • 如何使用原始 SQL 查询实现搜索功能

    我正在创建一个由 CS50 的网络系列指导的应用程序 这要求我仅使用原始 SQL 查询而不是 ORM 我正在尝试创建一个搜索功能 用户可以在其中查找存储在数据库中的书籍列表 我希望他们能够查询 书籍 表中的 ISBN 标题 作者列 目前 它
  • Pandas 将多行列数据帧转换为单行多列数据帧

    我的数据框如下 code df Car measurements Before After amb temp 30 268212 26 627491 engine temp 41 812730 39 254255 engine eff 15
  • 为什么 Pickle 协议 4 中的 Pickle 文件是协议 3 中的两倍,而速度却没有任何提升?

    我正在测试 Python 3 4 我注意到 pickle 模块有一个新协议 因此 我对 2 个协议进行了基准测试 def test1 pickle3 open pickle3 wb for i in range 1000000 pickle
  • 在本地网络上运行 Bokeh 服务器

    我有一个简单的 Bokeh 应用程序 名为app py如下 contents of app py from bokeh client import push session from bokeh embed import server do
  • python import inside函数隐藏现有变量

    我在我正在处理的多子模块项目中遇到了一个奇怪的 UnboundLocalError 分配之前引用的局部变量 问题 并将其精简为这个片段 使用标准库中的日志记录模块 import logging def foo logging info fo
  • 使用for循环时如何获取前一个元素? [复制]

    这个问题在这里已经有答案了 可能的重复 Python 循环内的上一个和下一个值 https stackoverflow com questions 1011938 python previous and next values inside
  • cv2.VideoWriter:请求一个元组作为 Size 参数,然后拒绝它

    我正在使用 OpenCV 4 0 和 Python 3 7 创建延时视频 构造 VideoWriter 对象时 文档表示 Size 参数应该是一个元组 当我给它一个元组时 它拒绝它 当我尝试用其他东西替换它时 它不会接受它 因为它说参数不是

随机推荐

  • 答题微信小程序实现(7):python3将题库处理成json格式的。

    通常来说 我们写答题程序的时候 拿到手的题库不会是json格式的 而是word或txt pdf就像考试卷子那样的 这里写一下用python3将普通题库处理成json格式 选择python3的原因是 相对于2 7版本 它对中文更友好 原始题库
  • 为什么uzi排到古手羽就秒_uzi为何见到古手羽就秒退?并非因为55开,而是小狗有1个直播习惯...

    UZI是LPL的顶尖ADC之一 这么多年为LPL赢得了不少荣誉 在职业赛场上表现出色的UZI 开了直播同样是效果爆炸 吸引了不少粉丝的观看 经常看UZI直播的粉丝可能有时候会发现一个奇怪的现象 那就是UZI在排到古手羽的时候会直接秒掉 每次
  • 红帽子redhat linux 9.0官方下载地址,附MD5校验码

    红帽子redhat linux 9 0官方下载地址如下 https archive download redhat com pub redhat linux 9 en iso i386 shrike i386 disc1 iso https
  • 洛谷-P1010-幂次方-普及(摁写+递归/二进制+递归)

    一 题目描述 二 示例及提示 输入格式 一行一个正整数 n 输出格式 符合约定的 n的 0 2 表示 在表示中不能有空格 输入输出样例 输入 1 1315 输出 1 2 2 2 2 0 2 2 2 2 2 0 2 2 2 2 0 2 2 0
  • [总结]PostgreSQL服务启动又停止的解决方法

    安装PostgreSQL数据库8 3版本后 启动数据库服务 却弹出提示服务启动后又停止 一些服务自动停止 如果他们没有什么可做的 例如性能日志和警报服务 这个时候需要查看事件查看器的报错消息 1 当错误为could not create i
  • 【Python】六个惊人的未知 Python 库

    大家好 我是Sonhhxg 柒 希望你看完之后 能对你有所帮助 不足请指正 共同学习交流 个人主页 Sonhhxg 柒的博客 CSDN博客 欢迎各位 点赞 收藏 留言 系列专栏 机器学习 ML 自然语言处理 NLP 深度学习 DL fore
  • MySQL安装和图形化工具Workbench

    阅读整理自 MySQL 必知必会 朱晓峰 详细内容请登录 极客时间 官网购买专栏 文章目录 安装与配置 1 选择安装类型 2 安装服务器及相关组件 3 配置服务器 4 身份验证 5 设置密码和用户权限 6 配置 Windows 服务 图形化
  • 毕业设计-基于大数据招聘岗位可视化系统-python

    目录 前言 课题背景和意义 实现技术思路 实现效果图样例 前言 大四是整个大学期间最忙碌的时光 一边要忙着备考或实习为毕业后面临的就业升学做准备 一边要为毕业设计耗费大量精力 近几年各个学校要求的毕设项目越来越难 有不少课题是研究生级别难度
  • compileDebugKotlin FAILED Unresolved reference: xxxx

    Task client compileDebugKotlin FAILED e MainActivity kt 64 13 Unresolved reference CommendUtils A项目引用了library 但是一直报错 解决
  • 基于A40I/T3 SDK平台的QT4.8移植和应用开发连载(四)-盈鹏飞嵌入式

    文记录了QT4 8图形界面在全志A40I T3 SDK平台上的移植过程 说明过程中可能会技术瑕疵 希望大家提供宝贵意见 本文移植的平台来自于盈鹏飞嵌入式的CoM X40I T3A平台 处理器分别时是全志的A40I T3 以下是盈鹏飞嵌入式C
  • 数据库多维迭代算法

    关键词 数据库 迭代 递归 多维 一 两种传统的数据库迭代结构算法 对于数据库的迭代结构 有两种传统的算法 递归算法和边界算法 比如对于下面图1的结构 图1 递归算法的数据结构如表1所示 节点id 节点值 父节点id 1 1111 2 3
  • USDP使用笔记(八)Flink配置及简单测试

    Flink配置Flink配置及简单测试 上一篇 https lizhiyong blog csdn net article details 123560865 将USDP2 0自带的Flink更换为Flink1 14后 还没有来得及改配置
  • pycharm如何配置Anaconda虚拟环境

    文章目录 一 Anaconda虚拟环境创建 二 pycharm添加虚拟环境 一 Anaconda虚拟环境创建 1 此电脑 右键 属性 高级系统设置 高级 环境变量 系统变量 path 新建 相应路径 Anaconda 相应路径 Anacon
  • 小程序和Vue写法的区别

    小程序和Vue写法的区别主要有以下几点 语法不同 小程序使用的是WXML WXSS和JS 而Vue使用的是HTML CSS和JSX 数据绑定方式不同 小程序使用的是双向数据绑定 而Vue使用的是单向数据流 1 在小程序中需要使用e curr
  • oracle数据库imp/sqlplus命令无效引发的问题

    好久没有使用Oracle数据库 在导入数据库dmp文件时出现imp命令无效 oracle导入dmp文件命令 imp user password ip 端口 server name file 文件路径 dmp full y 如 imp crm
  • HTML 常用快捷键,HTML介绍

    一 1 修改主题 2 3 修改 4 长代码换行 file setting general wrap 对勾选中 5 新建项目 file new project 6 关联浏览器 file setting tool web borther 复制路
  • bigdata_git版本控制系统

    一丶版本控制系统发展 集中式VCS 分布式VCS git 二丶git工作流程图 三丶分支管理 每个项目确立后可以添加多个分支 分支可以更新版本 只要分支没有合并提交 对其他人没有任何影响 这也是跟svn的不同 四丶内部数据存储方式 git统
  • 惠斯通电桥与运算放大器的输入失调电流和输入偏置电流

    在做数字开关气压表项目中 使用的气压传感器的结构是惠斯通电桥 输出差分信号 差分电压与气压大小成线性关系 运放的失调电压对精度影响很大 在这里考虑选择使用低漂移运放 在选择运放时考虑了输入电阻 失调电压的影响 如果运放的输入电阻大小与电桥电
  • 大模型训练避坑指南

    原文 https baijiahao baidu com s id 1760862056681517207 wfr spider for pc 自 2022 年 11 月底 ChatGPT 发布以来 大模型的热度持续发酵 相信高屋建瓴的讨论
  • 辛普森悖论_所谓的辛普森悖论

    辛普森悖论 We all know the Simpsons family from Disneyland but have you heard about the Simpson s Paradox from statistic theo