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

betpascal_pdf(n, k, l, m)
% betpascal_pdf.m - evaluates a Beta Pascal Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp, and Kotz,
%   J. Wiley, p.276, 2005. 
%
%  Created by Jim Huntley,  11/17/06
%

function [pdf] = betpascal_pdf(n, k, l, m)

%persistent t delt;

%if(isempty(t))
    tmin = 0;
    tmax = 1;
    nt = 1000;
    delt = (tmax-tmin)/(nt-1);
    t = tmin:delt:tmax;
%end

ft = binomial_coef(n-1,k-1) .* (1-t).^k .* t.^(n-k) .* t.^(l-1) .* (1-t).^(m-1) ./ beta(l,m);
pdf = simps(ft) * delt;

return


Contact us