chis_inv.m

来自「计量工具箱」· M 代码 · 共 34 行

M
34
字号
function x = chis_inv (p, a)
% PURPOSE: returns the inverse (quantile) at x of the chisq(n) distribution
%---------------------------------------------------
% USAGE: x = chis_inv(p,a)
% where: p = a vector of probabilities 
%        a = a scalar parameter
% NOTE: chis_inv(x,n) = gamm_inv(p,a/2)*2
%---------------------------------------------------
% RETURNS:
%        a vector x at each element of p from chisq(n) distribution      
% --------------------------------------------------
% SEE ALSO: chis_d, chis_cdf, chis_rnd, chis_pdf
%---------------------------------------------------

%        Anders Holtsberg, 18-11-93
%        Copyright (c) Anders Holtsberg
% documentation modified by LeSage to
% match the format of the econometrics toolbox
   

if (nargin ~= 2)
    error ('Wrong # of arguments to chis_inv');
end


if any(any(abs(2*p-1)>1))
   error('chis_inv: a probability should be 0<=p<=1')
end
if any(any(a<=0))
   error('chis_inv: dof is wrong')
end

x = gamm_inv(p,a*0.5)*2;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?