第1页 / 共1页
granger因果检验的matlab程序.doc
Code
Code
function [F1, F2]=z_grantest(u,y,m,n)
N = length(y);
if length(u)~=N, error('Improper input args.'), end
if nargin<4, n=m; end
thy_u = arx([y,u],[m, m, 0]);
thy = ar(y, m,'ls');
S1y=thy_u(1,1);
S2y=thy(1,1);
F1 = (N-2*m)*(S2y-S1y)/m/S1y;
Pf1=fpdf(F1,m,m);
thu_y = arx([u,y],[n, n, 0]);
thu = ar(u, n,'ls');
S1u=thu_y(1,1);
S2u=thu(1,1);
F2 = (N-2*n)*(S2u-S1u)/n/S1u;
Pf2=fpdf(F2,n,n);
if ~nargout
if F2>F1
disp('The second argument causes the first one.')
disp('The first argument causes the second one.')
else
end
end
相关推荐
- 2023年江西萍乡中考道德与法治真题及答案.doc
- 2012年重庆南川中考生物真题及答案.doc
- 2013年江西师范大学地理学综合及文艺理论基础考研真题.doc
- 2020年四川甘孜小升初语文真题及答案I卷.doc
- 2020年注册岩土工程师专业基础考试真题及答案.doc
- 2023-2024学年福建省厦门市九年级上学期数学月考试题及答案.doc
- 2021-2022学年辽宁省沈阳市大东区九年级上学期语文期末试题及答案.doc
- 2022-2023学年北京东城区初三第一学期物理期末试卷及答案.doc
- 2018上半年江西教师资格初中地理学科知识与教学能力真题及答案.doc
- 2012年河北国家公务员申论考试真题及答案-省级.doc
- 2020-2021学年江苏省扬州市江都区邵樊片九年级上学期数学第一次质量检测试题及答案.doc
- 2022下半年黑龙江教师资格证中学综合素质真题及答案.doc