Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates

by

James Huntley (view profile)

 

generates random variates from over 870 univariate distributions

lagbeta_pdf(x, n, alpha, bet, r)
% lagbeta_pdf.m - evaluates a Lagrangian Beta Probability Density.
%   See "Continuous Univariate Distributions", v.2, Johnson, Kotz, & Balakrishnan
%   J. Wiley, 1995, 255. 
%
%   Text gives incorrect PDF!!!
%
%  Created by Jim Huntley,  7/03/07
%

function [pdf] = lagbeta_pdf(x, n, alpha, bet, r)

arg = alpha * x;

sum1 = 0;
for jj = 1:r-1
    bc = binomial_coef(n+bet*(jj-1),jj-1);
    sum1 = sum1 - bc * alpha * arg^(jj-2) * (1 - arg)^(n+bet*(jj-1)-jj) ...
                    * ((jj-1)*(1-arg) - alpha*(n+bet*(jj-1)-jj+1)*x) ...
                    / (n+bet*(jj-1));
end
pdf = n * sum1;
    
return

Contact us