| 查看: 2629 | 回复: 3 | ||
| 当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖 | ||
[求助]
求助,matlab中的卡方检验怎么弄 已有2人参与
|
||
|
在help中输入chi2test然后查不到。。网上说是用这个指令 发自小木虫Android客户端 |
» 猜你喜欢
售中科院一区文章,我:8 O 5 5 1 O 5 4,含JCR-TOP
已经有4人回复
Materials Today Chemistry审稿周期
已经有5人回复
溴的反应液脱色
已经有7人回复
国自然申请面上模板最新2026版出了吗?
已经有11人回复
推荐一本书
已经有12人回复
基金申报
已经有4人回复
计算机、0854电子信息(085401-058412)调剂
已经有4人回复
纳米粒子粒径的测量
已经有7人回复
常年博士招收(双一流,工科)
已经有4人回复
参与限项
已经有5人回复
» 本主题相关价值贴推荐,对您同样有帮助:
求助,MATLAB中如何访问COMSOL中某个实体的体积?
已经有1人回复
呼叫版主,在线紧急求助,关于matlab中微分方程组参数拟合得问题!
已经有12人回复
求助,matlab运行后提示语句不正确。。具体见内
已经有2人回复
求助,matlab/ 1stOpt 自定义微分方程拟合实验数据来求方程中的参数
已经有9人回复
求助,Matlab求解矩阵方程
已经有0人回复
求助,matlab/ 1stOpt 自定义微分方程拟合实验数据来求方程中的参数
已经有1人回复
求助,matlab/ 1stOpt 自定义微分方程拟合实验数据来求方程中的参数
已经有4人回复
求助,matlab自定义微分方程拟合实验数据来求方程中的参数
已经有4人回复
求助,用matlab解微分方程组,希望高手能给予指点
已经有17人回复
紧急求助,matlab中输入延迟等类似的延迟是什么意思?
已经有1人回复
求助大虫,matlab中仿真问题设置了变量,可改变变量是貌似变量叠加了求解
已经有6人回复
求助大虫,matlab中用if语句设置变量初值
已经有8人回复
求助,MIMO系统做信道估计时,MATLAB编程设计初始H的方法?
已经有0人回复
新虫求助,matlab使用ode求解模型问题
已经有0人回复
紧急求助,关于matlab 的几个问题
已经有7人回复

3楼2016-09-17 10:37:38
【答案】应助回帖
感谢参与,应助指数 +1
|
function [p, Q]= chi2test(x) % Usage: [p, Q]= chi2test(x) % % The chi-squared test. % % Given a number of samples this function tests the hypothesis that the samples are % independent. If Q > chi2(p, nu), the hypothesis is rejected. % % Each column represents a variables, each row a sample. % % If you find any errors, please let me know: . % % ARGUMENTS: % x Absolut numbers. % p The prob ability value, calculated from Q. % Q The resulting Q-value. % % EXAMPLE 1 % In region A, 324 of 556 cows were red, whereas in region B 98 of 260 were red. % [p, Q]= chi2test([324, 556-324; 98, 260-98]) % p= % 4.2073e-08 % Q= % 30.0515 % With an error risk of about 4e-08, we can claim that the samples are independent. % % EXAMPLE 2 % Throw two different dices to see if they have the same probability of 1 (and 2, 3, 4, 5, 6). % We don't check if they are symetrical, only if the both behave in the same way. % [p,Q] = chi2test([15,10; 7,11; 9,7; 20,15; 26,21; 19,16]) % p= % 0.8200 % Q = % 2.2059 % The dices don't significantly behave differently. That is, they seem to behave in the same way. % % HISTORY: v.1.0, first working version, 2007-08-30. % % COPYRIGHT: (c) 2007 Peder Axensten. Use at own risk. % KEYWORDS: chi-squared test, chi-squared, chi2, test %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Check the arguments. if(nargin ~= 1), error('One and only one argument required!'); end if(ndims(x) ~= 2), error('The argument (x) must be a 2d matrix!'); end if(any(size(x) == 1)), error('The argument (x) must be a 2d matrix!'); end if(any(~isreal(x))), error('All values of the argument (x) must be real values!'); end % Calculate Q = sum( (a-np*)^2/(np*(1-p*)) ) s= size(x, 1); r= size(x, 2); np= sum(x, 2)/sum(sum(x)) * sum(x); % p=sum(x, 2)/sum(sum(x)) and n=sum(x) Q= sum(sum((x-np).^2./(np))); % Calculate cdf of chi-squared to Q. Degrees of freedom, v, is (r-1)*(s-1). p= 1 - gammainc(Q/2, (r-1)*(s-1)/2); end |

2楼2016-09-17 10:37:05
FMStation
至尊木虫 (知名作家)
- 应助: 591 (博士)
- 贵宾: 0.03
- 金币: 18173.2
- 红花: 97
- 帖子: 8891
- 在线: 1487.4小时
- 虫号: 2400059
- 注册: 2013-04-04
- 专业: 计算机应用技术
【答案】应助回帖
感谢参与,应助指数 +1
|
https://www.mathworks.com/help/stats/chi2gof.html chi2gof Chi-square goodness-of-fit test |
4楼2016-09-17 23:11:32












回复此楼