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

fmix_pdf(x, nn, p, nu1, nu2)
% fmix_pdf.m - evaluates a Binomial Mixture of a F Probability Density.
%   See "Continuous Univariate Distributions", v.2, Johnson, Kotz, & Balakrishnan, 
%   Wiley, 1995, p.355. 
%
%   Vector Form of PDF!!!
%
%  Created by Jim Huntley,  09/30/08
%

function[pdf] = fmix_pdf(x, nn, p, nu1, nu2)

%persistent ratio nsum ohnu1

%if(isempty(ratio))
    ratio = nu1 / nu2;
    nsum = 0.5 * (nu1+nu2);
    ohnu1 = 0.5 * nu1;
%end

for jx = 1:size(x,2)
    sum = 0;
    for jr = 1:nn+1
        r = jr - 1;
        sum = sum + binomial_coef(nn,r) * p^r * (1-p)^(nn-r) * x(jx)^(ohnu1+r-1) * ...
              ratio^(ohnu1+r) / (beta(ohnu1+r,0.5*nu2)*(1+ratio*x(jx))^(nsum+r));
    end
    pdf(jx) = sum;
end

return



Contact us