Risk Ratio 和 Odds Ratio
Data Science Day 15
Risk Ratio
Last time, e give a SAS example of Risk Difference to test if to groups are experiencing the same proportion of a certain event. In order to understand the ic better, e ill go over Risk Ratio.
Definition:
Risk Ratio or Relative Risk (RR) is the probability that an event ours in a group 1 relative to the probability that the same event ours in group 2.
Note: Without Loss of Generality, In clinical trials, e take a group to be actual treatment group and the other group is the placebo group.
Formula:
Risk Ratio (Relative Risk)= P(event in group1)/P(event in group 2)
Interpretation:
RR ≈ 1 ⇒ The proportion of events are similar in group 1 and group 2.
RR » 1 ⇒ Increased probability of events among those in group 1 pared to group 2.
RR « 1 ⇒ Decreased probability of events among those in group 1 pared to group 2.
Note: This is a general interpretation, e can explain in different scenarios.
Example:
#import Library
import numpy as np
import pandas as pd
import statsmodels.api as sm
import pylab as pl
import matplotlib.pyplot as plt
import seaborn as sns
#Read in Arthritis data
df = sm.datasets.get_rdataset("Arthritis", "vcd").data
#Create Ne variable Censor:
#Censor=0 means no-improvement
#Censor=1 means some or big improvement
df["Censor"]=np.here(df["Improved"]=="None", "0", "1")
#table for Treatment and Censor
tab=pd.crosstab(df["Treatment"], df["Censor"])
tab1=sm.stats.Table(tab)
print(tab1.table_orig)
table= np.asarray([[29,14],[13,28]])
t22=sm.stats.Table2x2(table)
print(t22.summary())
#Output Censor 0 1 Treatment Placebo 29 14 Treated 13 28 Estimate SE LCB UCB p-value -------------------------------------------------- Odds ratio 4.4621.785 11.154 0.001 Log odds ratio 1.495 0.467 0.579 2.412 0.001 Risk ratio 2.1270.579 2.412 0.003 Log risk ratio 0.755 0.253 0.260 1.250 0.003 --------------------------------------------------
#Visulatization
%matplotlib inline
pd.crosstab(df.Treatment, df.Censor).plot(kind="bar")
plt.title("Treatment vs Placebo")
plt.xlabel("Treatment Type for Arthritis")
plt.ylabel("Censor Status")
Summary
Censor=0, Arthritis problem remains
Censor=1, Arthritis problem improved
Odds Ratio
Odds Ratio= 4.462, this implies in Placebo Group has 4.5 times more likely to remain the Arthritis problem pared to the Treatment Group.
Risk Ratio
Risk Ratio=2.127 means in Placebo Group the probability of patients’ Arthritis problem remains increased pared to the Patients in Treatment Group.
Connections:
It is very easy to mix the concept for Odds Ratio and Risk Ratio.
Odds Ratio represents the odds of an event in group 1 pared to the event of odds in group 2, here odds means the event over non-event.
Odds in Placebo=1429
Odds in Treatment=2813
Risk Ratio=0.4642.0714=4.46
Risk Ratio means the probability of an event ourring in group 1 pared to the probability of the same event ourring in group 2.
P(censor=0 in Placebo)=4329
P(censor=0 in Treatment)=4113
Risk Ratio=0.3170.674=2.127
Conclusion:
Risk ratio pares the probability of the ourrence of the same event in to groups. In addition, e can use the Risk Difference to check if the to groups have the same Risk Ratio.
Happy Studying!
空调维修
- 我的世界电脑版运行身份怎么弄出来(我的世界
- 空调抽湿是什么意思,设置抽湿的温度有什么意
- 方太燃气灶有一个打不着火 怎么修复与排查方法
- 夏季免费清洗汽车空调的宣传口号
- 清洗完空调后出现漏水现象
- iphone6能玩什么游戏(iphone6游戏)
- 如何设置电脑密码锁屏(如何设置电脑密码锁屏
- win10删除开机密码提示不符合密码策略要求
- 电脑w7显示不是正版(w7不是正版怎么解决)
- 万家乐z8热水器显示e7解决 怎么修复与排查方法
- 1匹空调多少瓦数(1匹空调多少瓦)
- 安卓手机连接电脑用什么软件好(关于安卓手机
- 电脑网页看视频卡是什么原因(爱拍看视频卡)
- 华帝燃气灶点火器一直响然后熄火怎么办:问题
- 电脑壁纸怎么换(关于电脑壁纸怎么换的介绍)
- 冬天空调的出风口应该朝什么方向(冬天空调风