# 卡方检验函数

通常用于定性变量研究。该函数可用来将在单向频率表中观察到的频率与预期的频率进行比较，或者研究列联表中两个变量之间的连接。Chi-squared test functions are used to determine whether there is a statistically significant difference between the expected frequencies and the observed frequencies in one or more groups. Often a histogram is used, and the different bins are compared to an expected distribution.

使用每个函数的下拉列表可查看每个函数的简短描述和语法。单击语法描述中的函数名称可了解更多信息。

如果在数据加载脚本中使用此函数，则值会迭代于 group by 子句定义的大量记录。

如果在图表表达式中使用此函数，则值迭代于图表维度。

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/StatisticalTestFunctions/chi2-tests/chi2_tests.htm)

#### Chi2Test\_chi2

Chi2Test\_chi2() 用于返回一个或两个值系列的聚合卡方检验值。

[**chi2test_chi2**](https://help.qlik.com/zh-CN/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/StatisticalTestFunctions/chi2-tests/chi2test_chi2.htm)(col, row, actual\_value[, expected\_value])

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/StatisticalTestFunctions/chi2-tests/chi2_tests.htm)

#### Chi2Test\_df

Chi2Test\_df() 用于返回一个或两个值系列的聚合卡方检验 df 值（自由度）。

[**chi2test_df**](https://help.qlik.com/zh-CN/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/StatisticalTestFunctions/chi2-tests/chi2test_df.htm)(col, row, actual\_value[, expected\_value])

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/StatisticalTestFunctions/chi2-tests/chi2_tests.htm)

#### Chi2Test\_p

Chi2Test\_p() 用于返回一个或两个值系列的聚合卡方检验 P 值（显著性）。

[**chi2test_p**](https://help.qlik.com/zh-CN/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/StatisticalTestFunctions/chi2-tests/chi2test_p.htm)(col, row, actual\_value[, expected\_value])

## 了解详情

* [T 检验函数](https://help.qlik.com/zh-CN/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/StatisticalTestFunctions/ttest/t_tests.htm)
* [Z 检验函数](https://help.qlik.com/zh-CN/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/StatisticalTestFunctions/ztest/z_tests.htm)