tdis_pdf.m

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

M
31
字号
function pdf = tdis_pdf(x, n)
% PURPOSE: returns the pdf at x of the t(n) distribution
%---------------------------------------------------
% USAGE: pdf = tdis_pdf(x,n)
% where: x = a matrix, vector or scalar 
%        n = a matrix or scalar parameter with dof
%---------------------------------------------------
% RETURNS:
%        a matrix of pdf at each element of x of the t(n) distribution      
% --------------------------------------------------
% SEE ALSO: tdis_cdf, tdis_rnd, tdis_inv, tdis_prb
%---------------------------------------------------

% written by:
% James P. LeSage, Dept of Economics
% University of Toledo
% 2801 W. Bancroft St,
% Toledo, OH 43606
% jpl@jpl.econ.utoledo.edu

if (nargin ~= 2)
    error ('Wrong # of arguments to tdis_pdf');
end
  
if any(any(n<=0))
   error('dof in tdis_pdf is wrong')
end

pdf = gamma((n+1)/2)./sqrt(n*pi)./gamma(n/2).*(1+x.^2./n).^(-(n+1)/2);
     

⌨️ 快捷键说明

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