==== 卡方独立性检验 (Chi-square independence test)====
当变量类型为命名变量或顺序变量时,我们可以用卡方独立性检验来检验两个变量是否相关。
When the variable type is named or sequential, we can use the Chi-square independence test to check whether the two variables are related.
----
=== 卡方独立性检验的数据结构 (Data structure for Chi-square independence test)===
卡方独立性检验的数据结构如下图:
{{ ::卡方独立性检验的数据结构.jpg?nolink&600 |}}
The data structure of the Chi-square independence test is shown in the figure above.
----
=== 卡方独立性检验的前提和限制 (The premise and limitation of Chi-square independence test)===
1、观察彼此独立; (Observations are independent of each other.)
2、单位格期望fe不小于5。 (The expectation of a unit cell fe is not less than 5.)
----
=== 卡方独立性检验的计算方法 ===
**1、确定虚无假设和备择假设**
H0:因素A和因素B是独立的
**2、计算单位格的期望值**
{{ ::f的计算.jpg?nolink&200 |}}
其中mr和nc分别代表单元格所在行总和和所在列总和。
**3、计算卡方**
卡方的计算和卡方匹配度检验中相同:
{{ ::卡方的计算.jpg?nolink&250 |}}
**4、确定自由度df和显著性水平α**
卡方独立性检验的自由度为:
{{ ::卡方检验自由度.jpg?nolink&250 |}}
**5、查表找出临界卡方值进行比较**