📄 ftest.m
字号:
function fstat = ftest(p,n,d)
%FTEST Inverse F test
% Calculates the F statistic given the probability point
% (p) and the numerator (n) and denominator (d) degrees
% of freedom.
% I/O format is fstat = ftest(p,n,d);
% Based on a public domain stats toolbox
% Modified by B.M. Wise November 1993
% Modified by B.M. Wise December 1994
p = 1-p;
n = n/2;
d = d/2;
ic = 1;
xl = 0.0;
xr = 1.0;
fxl = -p;
fxr = 1.0 - p;
if fxl * fxr > 0
error('probability not in the range(0,1) ')
else
while ic < 30
x = (xl + xr) * 0.5;
p1 = beta(x,n,d);
fcs = p1 - p;
if fcs * fxl > 0
xl = x;
fxl = fcs;
else
xr = x;
fxr = fcs;
end
xrmxl = xr - xl;
if xrmxl <= 0.0001 | abs(fcs) <= 1E-4
break
else
ic = ic + 1;
end
end
end
if ic == 30
error(' failed to converge ')
end
% Inverted numerator and denominator 12-26-94
fstat = (d * x) / (n - n * x);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -