R数据分析:什么是人群归因分数Population Attributable Fraction

74 篇文章 318 订阅

今天在论文中看到个这么一个术语Population Attributable Fraction,中文叫人群归因分数,意思是暴露如果被取消,某个结局减少的比例,比如我知道了孤独感对抑郁有影响,计算PAF可以得出,如果孤独感被干预,抑郁人群比例会下降多少:

PAF; the proportionof cases of depression that could be prevented if the influence of loneliness was removed

这么一个指标在经济评价的文章也有见过,就是我预防了人群某个风险因素之后我能为国家省多少医疗支出。

写研究意义的用得上哦。

今天就给大家介绍一下这个指标:

人群归因分数初识

这个指标也叫做人群归因比Population Attributable Proportion或者归因比Attributable Proportion Among the Total Population

(Also called the Population Attributable Proportion or Attributable Proportion Among the Total Population)

PAF是一个评估暴露的人群作用的非常常见的流行病学指标,表达的意思是如果某个暴露取消,结局会减少的百分比。

PAF is the estimated fraction of all cases that would not have occurred if there had been no exposure

这个指标基本的原理就是用可以归因为暴露的病例数,除以总的病例数(O)。

可以归因为暴露的病例数则计算为总病例数(O)减去不能归因暴露的病例数(E)

所以总的PAF的理论表达就是(O − E)/O

where O and E refer to the observed number of cases and the expected number of cases under no exposure, respectively

对于一个前瞻性队列研究,我们先看下面的表格,把上面的思路走一遍:

1400个人得病的人(O),其中900个有暴露,500个没有暴露,所以我们只有500/1,400 = 0.357,也就是35.7%的得病可以归因为这个暴露。

上面的描述很简单,但是我们到此可以说如果我们将人群的暴露取消掉,原来的35.7%的人就不会得病了嘛?

仔细想想,也不对。因为人群中就算没有这个暴露也依然会发病的,这个叫would be if not exposed. 所以上面斜体部分描述的思路过程都是错误的,它并没有考虑清楚什么是不能归因为暴露的病例数(E)。

那么这个E怎么算呢?应该是没这个暴露也会发病的数900除以没暴露的总人数90000再乘以10000=100

就是说其实是有100人是没暴露也会发病的,所以这100人发病并非是暴露的作用,我们得扣掉它,剩下400,可以归因到这个具体的暴露:

所以我们的其实是400人可以归因,那么PAF=1400-(1400-400)/1400=0.286,最终我们得到28.6%患抑郁是因为孤独这个因素。这个28.6%就是暴露的人群归因分数。

上面的过程都是帮助大家理解的自我推导。

接下来我们给出PAF在前瞻性研究中的计算公式如下:

Population Attributable Fraction (PAF) = (proportion of cases exposed) x (attributable proportion in the exposed)

或者:

在上面的公式中,Ppop 为总人群暴露率,RR是风险比。

总人口暴露率在我们刚刚的例子中就是10000/100000=0.1

风险比就是两个风险的比,暴露组风险比上非暴露组风险,在我们的例子中就是500/10000=0.05比上非暴露组风险900/90000=0.01,然后风险比就是5.

然后我们套公式可以得到PAF=(0.1*4)/((0.1*4)+1)=0.286

可以看到我们的结果都是一样的。

上面介绍了RR与PAF,RR是我们知道暴露与否,是在前瞻性研究中的一个指标,接下来看OR与PAF

OR值与PAF

写之前还是再给大家补充下,有时候你会遇到PAR人群归因风险,这个和PAF也是一个东西

依然是给大家一个回顾性研究的四格表,此时我们是先知道结局:

我们的OR就是两个比值的比比值就是暴露比值

对于上表来说我们的结局为YES组的暴露比值为(a/(a+b)) ÷ (b/(a+b)) = a/b;结局为NO的暴露比值为(c/(c+d)) ÷ (d/(c+d)) = c/d

然后,两个比值的比OR就为(a/b)/(c/d)=ad/bc

我们是先知道结局才能算的OR,OR是回顾性研究的指标

上面的知识点仅供大家复习,当我我们的结局比较罕见的时候,RR OR HR都是可以通用的所以PAF的计算也是如上述公式。

We can use valid estimates of hazard ratio (or rate ratio) from cohort studies or odds ratio from case-control studies instead of RR in the Miettinen PAF formula if the outcome is uncommon.

OR和RR的区别与联系

RR来评价暴露组研究对象的发病风险是非暴露组研究对象的多少倍?这个“多少倍” 就是RR。是前瞻性研究的指标。

比值比(Odds Ratio, OR)是在回顾性研究中评价暴露因素和疾病的关联强度的指标,评价的是发病与不发病两组暴露的比,同样可以说明暴露的影响。解释也和RR类似。

并且,在横断面研究中OR可以近似RR

The relative risk is often approximated by the odds ratio e.g. in cross-sectional studies.

刚刚也说到RR OR HR都是可以通用的,所以PAF的计算也是如上述公式,这儿有个前提条件就是结局比较罕见或者说结局的发生率比较低。

我们还是来看个具体例子,依然是个表格

对于上表,我们有:

RR = (20/1000) ÷ (10/1000) = 2

OR= (20×990) ÷ (10×980) = 2.02

因为此时的结局发生率只有30/2000=0.015,很小,所以RR和OR确实是不差多少的。

再看一个结局发生率比较高的:

此时我们有:

RR = (500/1000) ÷ (250/1000) = 2

OR = (500×750) ÷ (250×500) = 3

RR和OR展示了巨大的差异,就是因为结局的发生率有点高了,达到了750/2000=0.375.

所以我们只有在结局比较罕见或者说结局的发生率比较低的时候才能用OR估计RR从而得到PAF。

如何使用R计算PAF

上面的介绍都是用的4格表在介绍原理,真正的研究中我们还会控制各种因素后得到OR值,此时的PAF计算又需要重新考虑了。

比如对于一个二分类结局变量我们要做PAF用到的函数就是Af.cs。

Af.cs estimates the attributable fraction for a binary outcome Y under the hypothetical scenario where a binary exposure X is eliminated from the population. The estimate is adjusted for confounders Z by logistic regression (glm). Let the AF be defined as

AF = 1 - Pr(Y0 = 1) / Pr(Y = 1)

where Pr(Y0 = 1) denotes the counterfactual probability of the outcome

我现在有如下数据集,一个因变量Y,一个自变量X和协变量Z:

直接给出模型公式,指定好暴露变量就可以得到该暴露的PAF,具体代码如下:

AF.cs_est <- AF.cs(formula = Y ~ X + Z + X * Z, data = data, exposure = "X")
summary(AF.cs_est)

输出结果如下图:

也就是说在我的数据集中,如果去掉X这个暴露,就会减少大概18%的Y的发生。

小结

今天给大家写了PAF的意义和计算方法,顺带回顾了RR和OR的区别联系,希望可以给大家以启发。感谢大家耐心看完,自己的文章都写的很细,代码都在原文中,希望大家都可以自己做一做,请转发本文到朋友圈后私信回复“数据链接”获取所有数据和本人收集的学习资料。如果对您有用请先收藏,再点赞分享。

也欢迎大家的意见和建议,大家想了解什么统计方法都可以在文章下留言,说不定我看见了就会给你写教程哦,另欢迎私信。

  • 10
    点赞
  • 42
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 8
    评论
This is the readme file for the disk that accompanies the following book: Serial Port Complete: Programming and Circuits for RS-232 and RS-485 Links and Networks by Jan Axelson copyright 1998 ISBN #0-9650819-2-3 Published by: Lakeview Research 2209 Winnebago St. Madison, WI 53704 Phone: 608-241-5824 Fax: 608-241-5848 Web: http://www.lvr.com Email: [email protected] *** This readme file contains descriptions of the other files on the disk, tips for using the files, and listings of the files and directories arranged alphabetically and by computer type and chapter number. Rules for Use All of the files on this disk are provided for your use. You may use any or all portions of the files in your programs and distribute such programs without payment of royalties, if you agree to the following disclaimer: The information, computer programs, documentation, and other material on this disk are provided "as is," without warranty of any kind, expressed or implied, including without limitation any warranty concerning the accuracy, adequacy, or completeness of the material or the results obtained from using the material. Neither the publisher nor the author shall be responsible for any claims attributable to errors, omissions, or other inaccuracies in the material on this disk. In no event shall the publisher or author be liable for direct, indirect, special, incidental, or consequential damages in connection with, or arising out of, the construction, performance, or other use of the materials contained herein. ***
分析平安银行可以从以下几个方面入手: 1. 财务分析:通过分析平安银行的财务报表,包括资产负债表、利润表和现金流量表等,来了解公司的盈利能力、财务状况和现金流量状况等。 2. 市场分析:通过分析平安银行的股价走势、市值、市盈率等指标,来了解公司在市场上的表现和市场对公司的看法。 3. 行业分析:通过了解银行业的整体市场环境、行业发展趋势、竞争格局等因素,来了解平安银行在行业中的地位和发展前景。 以下是通过Python进行财务分析的示例代码: ```python import pandas as pd import numpy as np import matplotlib.pyplot as plt # 读取平安银行财务报表数据 data = pd.read_excel('path/to/file.xlsx', sheet_name='Profit') data.head() # 计算平安银行的营业收入、净利润、总资产和净资产 revenue = data.loc[data['Item'] == 'Operating revenue', 'Value'].values[0] net_income = data.loc[data['Item'] == 'Net profit attributable to shareholders of the parent company', 'Value'].values[0] total_assets = data.loc[data['Item'] == 'Total assets', 'Value'].values[0] total_equity = data.loc[data['Item'] == 'Total equity attributable to shareholders of the parent company', 'Value'].values[0] # 计算平安银行的净利润率、总资产收益率和净资产收益率 net_profit_margin = net_income / revenue roe = net_income / total_equity roa = net_income / total_assets # 打印结果 print('平安银行\n') print('营业收入:', revenue) print('净利润:', net_income) print('总资产:', total_assets) print('净资产:', total_equity) print('净利润率:', net_profit_margin) print('总资产收益率:', roa) print('净资产收益率:', roe) ``` 你需要将代码中的`path/to/file.xlsx`替换为你的数据文件路径,并且需要确保数据文件中包含平安银行的财务报表数据,并且工作表名称为`Profit`。通过运行代码,你可以得到平安银行的财务指标,并对其进行分析。如果需要进行更深入的分析,可以使用其他的Python库,例如pandas、numpy、matplotlib等。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

公众号Codewar原创作者

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值