McNemar test麦克尼马尔检验

医药项目统计联系QQ:231469242

 

McNemar’s Test用于配对的2*2表格,例如如果你要比较两个医生对同一个病人治疗效果。一个病人自控,药物治疗前和治疗后结果比较。

McNemar’s Test用于检验(a+b)/N 和(a+c/N)是否显著?

McNemar’s Test的两个分类变量不是独立的,而是相关的,因为(a+b)/N 和(a+c/N)都包含a

McNemar’s Test This is a matched pair test for 2  *   2 tables. For example,
if you want to see if two doctors obtain comparable results
when checking (the same) patients, you would use this test.

 

 

 

 

 

http://www.doc88.com/p-7337013497692.html

 

 

 

 

 

 

 

 

 python代码测试一致

 

# -*- coding: utf-8 -*-
'''
QQ:231469242,by Toby
''' # Import standard packages import numpy as np import scipy.stats as stats import pandas as pd # additional packages from statsmodels.sandbox.stats.runs import cochrans_q, mcnemar #药物测试,对疾病是否治愈,要求相同对象群体 #obs = np.array([[101, 121],[59, 33]]) obs = np.array([[2, 4],[0, 4]]) def Mcnemar(obs): '''McNemars Test should be run in the "exact" version, even though approximate formulas are typically given in the lecture scripts. Just ignore the statistic that is returned, because it is different for the two options. In the following example, a researcher attempts to determine if a drug has an effect on a particular disease. Counts of individuals are given in the table, with the diagnosis (disease: present or absent) before treatment given in the rows, and the diagnosis after treatment in the columns. The test requires the same subjects to be included in the before-and-after measurements (matched pairs). ''' (statistic, pVal) = mcnemar(obs) print('\nMCNEMAR\'S TEST -----------------------------------------------------') print('p = {0:5.3f}'.format(pVal)) if pVal < 0.05: print("There was a significant change") else: print("There was no significant change") Mcnemar(obs) ''' p = 0.125 There was no significant change '''

 

 

 

 

例题2

 

python结果无显著差异

 

 

例题3

 

 

 

 

 

练习

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值