当前位置:网站首页>Super simple case: how to do hierarchical chi square test?
Super simple case: how to do hierarchical chi square test?
2022-06-25 08:24:00 【spssau】
Chi square test study X and Y The difference of ,X and Y Are category data . At present, another disturbing factor layering item needs to be further considered . Like smoking or not (X) And whether you are ill (Y) The relationship between , Taking gender into account ( That is, confounding factors , Hierarchical item Factor). This is called hierarchical chi square , Layered chi square is also known as Cochran-Mantel-Haenszel test (CMH test ), Layered chi square can be a good solution ‘ Simpson paradox ’ problem .SPSSAU Support 2*2*K Structural data ( namely X and Y Are all 2 classification ,K layer ).
One 、 Theoretical explanation
Hierarchical chi square is based on Chi square test , Further consider the interference of layered terms ( Confounding factors ), It is usually necessary to analyze confounding factors ( Hierarchical item ) There is a certain degree of foreknowledge ( Or references ), Then the hierarchical chi square test .
- For layered chi square , It involves the following theoretical knowledge , The following table :

Usually , First of all to see ‘ Odds ratio homogeneity test ’, If it shows significance (p Less than 0.05), It indicates that there are confounding factors , That is, you need to consider hierarchical items , That is to view the data results under different layers . On the contrary, if it fails ‘ Odds ratio homogeneity test ’, That is to say, there are no confounding factors and there is no need to consider the stratification item , Just report the overall results ( Including chi square test , as well as OR value ). Cochran–Mantel–Haenszel Conditional independence was used to study confounding factors ( Hierarchical item ) after ,X And Y Whether there are still differences between , Relatively small .
Two 、 Layered chi square case
1、 background
There is a current study on the impact of smoking on the risk of colds , share 1046 Research subjects , And record whether you have a cold , Smoking or not , And gender information .
2、 Data description
Raw data ( Analog data ) as follows :

The raw data is in a weighted format .
- Whether to smoke , Numbers 1 Express ‘ smoking ’, Numbers 2 Express ‘ No smoking ’;
- Do you have a cold , Numbers 1 Express ‘ Catch a cold ’, Numbers 2 Express ‘ No colds ’.
- When stratified by gender , Numbers 1 Express ‘ male ’, Numbers 2 Express ‘ Woman ’, Numbers 3 Express ‘ A secret ’.
- Weighted terms weight Indicates the number of combinations of categories of each research object , such as 465 Express , The number of men who smoke and have a cold .
- Tips :
- For layered chi square ,SPSSAU Support 2*2*k structure , namely X and Y Are all 2 Categories , Whether to smoke and whether to catch a cold ,k Indicates the number of categories of hierarchical items ,( The cases are divided into ‘ male ’,‘ Woman ’ and ‘ A secret ’, Then for 3 layer ).
3、 Operation steps
This case uses the weighted data format , The operations for placing analysis items are as follows :

Use path :SPSSAU→ experiment / Medical research → Layered chi square
4、SPSSAU Output results
SPSSAU Co output 5 Class table , Here's how :
| form | explain |
| Cochran-Mantel-Haenszel test Basic explanation | Basic summary of analysis items . |
| Hierarchical chi square test summary table | √ When showing layers and non layers ,X And Y Chi square test of ;√ Use fisher Chi square test , And show OR Values and 95% Section . |
| Mantel-Haenszel Common Ratio OR Value estimate | Exhibition Mantel-Haenszel Common Ratio OR value , as well as OR The logarithm of the value , And show 95% Section . |
| Odds ratio homogeneity test (Breslow-Day-Tarone) | Exhibition Breslow-Day Odds ratio homogeneity test . |
| Cochran–Mantel–Haenszel Conditional independence test | Exhibition chran–Mantel–Haenszel Conditional independence test . |
① Hierarchical chi square test summary table

The table above shows each layer ( And no layering ) In this case , Data of each cross category item , And output OR Values and fisher Chi square value , For example, when there is no layering , That is, when gender is not considered at all ,‘ Smoking or not ’ And ‘ Do you have a cold ’ There is a significant difference between (χ2=15.136, p =0.000<0.01),OR The value is 2.077, That means smoking is a risk factor on the whole , And the risk of smoking is not smoking 2.077 times . But when considering hierarchically , Significant only in men (χ2=5.514, p =0.024<0.05), However, there is no significant difference between women and secret groups ( p > 0.05). That is to say, the existence of confounding factors may need to be considered ( That is, hierarchical items exist ), Next, the corresponding layered items will be inspected and explained .
②Mantel-Haenszel Common Ratio OR Value estimate

- Tips :
- here 95% The calculation of the confidence interval is based on the assumption that OR value =1 Calculate .
The table above shows Mantel-Haenszel Common Ratio OR value ,OR The value is 1.772, That means smoking is a risk factor on the whole , And the risk of smoking is not smoking 1.772 times (95% CI: 1.1760 ~ 2.6701).
③ Odds ratio homogeneity test results

The table above shows the odds ratio homogeneity test , By default Breslow-Day Method , The table above shows that the odds ratio homogeneity test was not passed (χ2=1.089, p=0. 5801>0.1), This means that the layers are homogeneous , There is no confounding , That is, there are no confounding factors ( Gender ), That is, it is not necessary to report the corresponding values of each layer separately ( such as OR value ), The overall report is sufficient , The overall... Can be reported here Mantel-Haenszel Common Ratio OR Value is 1.772.
SPSSAU Automatic output of intelligent analysis results :

④Cochran–Mantel–Haenszel Conditional independence test

The above table shows the conditional independence results ,Mantel-Haenszel Common The law rejects the original assumption (χ2=7.0547, p=0. 0079<0.01), That is to say, controlling confounding interference factors ( Gender ) after , There is still a significant difference between smoking and cold , and OR The value is 1.772, Smoking is a risk factor , And the risk of smoking is not smoking 1.772 times .
5、 Analysis of key points
① Layered chi square ,SPSSAU Support weighted and unweighted formats , A weighted format is usually used , Drop down selection during analysis ‘ Weighted terms ’ that will do .
② Whether there are confounding factors in the study of odds ratio homogeneity test ( That is, whether the existence of hierarchical items is meaningful ).
③ Mantel-Haenszel Common Ratio OR value , As a whole when chi square test is performed separately OR The values are not consistent ,Mantel-Haenszel Common Ratio OR The value can be understood as a correction OR value , But they have the same meaning .
边栏推荐
- FM signal, modulated signal and carrier
- Wechat applet introduction record
- Bluecmsv1.6-代码审计
- Luogu p1073 [noip2009 improvement group] optimal trade (layered diagram + shortest path)
- Common action types
- 想开个户,网上股票开户安不安全?
- DNS protocol and its complete DNS query process
- 4个不可不知的采用“安全左移”的理由
- 想转行学软件测试担心哪些问题?
- Use pytorch to build mobilenetv2 and learn and train based on migration
猜你喜欢

How to calculate the positive and negative ideal solution and the positive and negative ideal distance in TOPSIS method?

面试前准备好这些,Offer拿到手软,将军不打无准备的仗

How to interpret the information weight index?

Use pytorch to build mobilenetv2 and learn and train based on migration

STM32CubeMX 学习(5)输入捕获实验

Stm32cubemx learning (5) input capture experiment

Daily question brushing record (III)

Electronics: Lesson 012 - Experiment 13: barbecue LED

每日刷题记录 (三)

CVPR 2022 Oral 2D图像秒变逼真3D物体
随机推荐
How to calculate the information entropy and utility value of entropy method?
4 reasons for adopting "safe left shift"
First experience Amazon Neptune, a fully managed map database
What are the indicators of DEA?
What about the exponential smoothing index?
Daily question brushing record (III)
Free SSL certificate acquisition tutorial
Stack awareness - stack overflow instance (ret2libc)
4 raisons inconnues d'utiliser le "déplacement sûr à gauche"
打新债安全不 有风险吗
[supplementary question] 2021 Niuke summer multi school training camp 9-N
想开个户,网上股票开户安不安全?
什么是SKU和SPU,SKU,SPU的区别是什么
Drawing of clock dial
leetcode.13 --- 罗马数字转整数
Is it safe to open an account online? Xiaobai asks for guidance
Scanpy(七)基于scanorama整合scRNA-seq实现空间数据分析
iframe简单使用 、获取iframe 、获取iframe 元素值 、iframe获取父页面的信息
以科技赋能设计之美,vivo携手知名美院打造“产学研”计划
4個不可不知的采用“安全左移”的理由