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

beta2mix_pdf(x, nn, p, a, b)
% beta2mix_pdf.m - evaluates a Binomial Mixture of Beta2 Probability Densities.
%   See "Continuous Univariate Distributions", Johnson, Kotz, and
%   Balakrishnan, V2, J. Wiley, , p.250, 1996. 
%
%   Vector Form of PDF !!!
%
%  Created by Jim Huntley,  10/30/06
%

function [pdf] = beta2mix_pdf(x, nn, p, a, b)

for jx = 1:size(x,2);
    sum1 = 0;
    for jr = 1:nn+1
        sum1 = sum1 + binomial_coef(nn,jr-1)*p^(jr-1)*(1-p)^(nn-jr+1)*x(jx)^(0.5*a+jr-2) ...
                    / (beta(0.5*a+jr-1,0.5*b)*(1+x(jx))^(0.5*(a+b)+jr-1));
    end
    pdf(jx) = sum1;    
end 

return

Contact us