>>两个正态总体方差的检验(F检验)
0
推荐function [h,f,f1]=ftest0(X,Y,a,tail)
%参考文献:《应用数理统计》(叶慈南编)p122.
%两个正态总体方差的检验(F检验)
%调用格式:[h,f,f1]=ftest0(X,Y,a,tail)
%X,Y为样本,a为显著性水平
%TAIL must be ''both'', ''right'', or ''left'', or 0, 1, or -1.'
%Author: Ji Lin, 2007
if nargin if nargin n1=length(X);n2=length(Y);
f=var(X)/var(Y);
if tail == 0 % two-tailed test
f1=finv(1-a/2,n1-1,n2-1);f2=finv(a/2,n1-1,n2-1);
if (f1 h = '拒绝H0';
else
h = '接受H0';
end
elseif tail == 1 % right one-tailed test
f1 = finv(1-a,n1-1,n2-1);
if chi21 h = '拒绝H0';
else
h = '接受H0';
end
elseif tail == -1 % left one-tailed test
f1 = finv(a,n1-1,n2-1);
if f h = '拒绝H0';
else
h = '接受H0';
end
else
error('stats:ftest:BadTail',...
'TAIL must be ''both'', ''right'', or ''left'', or 0, 1, or -1.');
end