我们能用MATLAB做‘卡方独立’测试吗?如果是,我正在寻找一个‘可靠’的工作例子。我没有尝试过,我对此也不熟悉。
发布于 2020-04-09 07:59:43
是。您可以使用在文件交换中找到的函数:https://es.mathworks.com/matlabcentral/fileexchange/7143-chi-square-test-for-independence。
要执行测试,只需使用您的数据和间隔数调用函数chi2test(data, numOfInterval)
即可。
示例代码
data = rand(1000, 1000);
num_int = 8;
chi2test(data, num_int);
x =
5.6000
ans =
14.0671
其中x
是独立性卡方检验的结果,ans
是卡方累积分布函数的反函数,其中num_int
自由度是为data
中的相应概率指定的。
有关此函数的详细信息,请参阅1。
1凯文·王(2020)。卡方独立测试(https://www.mathworks.com/matlabcentral/fileexchange/7143-chi-square-test-for-independence),MATLAB中央文件交换。检索于2020年4月12日。
https://stackoverflow.com/questions/61111821
复制相似问题