当前位置:网站首页>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 .
边栏推荐
- [red flag Cup] Supplementary questions
- The era of enterprise full cloud -- the future of cloud database
- 物联网毕设(智能灌溉系统 -- Android端)
- Luogu p2839 [national training team]middle (two points + chairman tree + interval merging)
- 面试前准备好这些,Offer拿到手软,将军不打无准备的仗
- 4個不可不知的采用“安全左移”的理由
- June training (day 25) - tree array
- 第五天 脚本与UI系统
- 420 sequence traversal of binary tree 2 (429. sequence traversal of n-ary tree, 515. find the maximum value in each tree row, 116. fill in the next right node pointer of each node, 104. maximum depth
- Jdbc-dao layer implementation
猜你喜欢

2022年毕业生求职找工作青睐哪个行业?

Electronics: Lesson 012 - Experiment 11: light and sound

Stack awareness - stack overflow instance (ret2libc)

CVPR 2022 Oral 2D图像秒变逼真3D物体

Drawing of clock dial

Stm32cubemx learning (5) input capture experiment

STM32CubeMX 學習(5)輸入捕獲實驗

The era of enterprise full cloud -- the future of cloud database

堆栈认知——栈溢出实例(ret2libc)

How to do factor analysis? Why should data be standardized?
随机推荐
Sword finger offer (simple level)
Almost taken away by this wave of handler interview cannons~
测一测现在的温度
堆栈认知——栈溢出实例(ret2libc)
Stack awareness - stack overflow instance (ret2libc)
在网上股票开户安全吗?证券账户可以给别人用吗?
With the beauty of technology enabled design, vivo cooperates with well-known art institutes to create the "industry university research" plan
使用pytorch搭建MobileNetV2并基于迁移学习训练
What is SKU and SPU? What is the difference between SKU and SPU
Websocket understanding and application scenarios
初体验完全托管型图数据库 Amazon Neptune
After using the remote control of the working machine, problems occurred in the use of the local ROS, and the roscore did not respond
Allgero reports an error: program has encoded a problem and must exit The design will be saved as a . SAV file
Electronics: Lesson 010 - Experiment 9: time and capacitors
How to analyze the coupling coordination index?
Is there any risk in the security of new bonds
Apache CouchDB Code Execution Vulnerability (cve-2022-24706) batch POC
Go语言学习教程(十三)
Luogu p2048 [noi2010] super Piano (rmq+ priority queue)
Bluecmsv1.6-代码审计