Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates

by

 

generates random variates from over 870 univariate distributions

dist_pdf(n, nmin, m, a, b)
% dist_pdf.m - evaluates a Discrete T Probability Density.
%   See "The Discrete Student's T Distribution, J.K. Ord, Annals of Math Stat, 1968, 
%   Vol.39, No.5, p.1513.
%
%  Created by Jim Huntley,  9/7/06
%

function [pdf] = dist_pdf(n, nmin, m, a, b)

%persistent am 

%if(isempty(am))
    wab = imag(psi(1+a+b*i)) + imag(psi(2-a+b*i)) + ...
              b/(a^2+b^2) + b/(b^2+(1-a)^2);
    am = 1;
    for jm = 1:m    
        am = am * (jm^2+4*b^2);
    end
    am = am * b / ((binomial_coef(2*m,m)*wab));
%end

prod = 1;
for jj = 1:m+1
    prod = prod * (1 / ((jj-1+a+n)^2 + b^2));
end
    
pdf = am * prod;

return

Contact us