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

qbaildaum_pdf(n, a, q)
% qbaildaum_pdf.m - evaluates a q-Bailey Daum Probability Density.
%   See "Steady-State Markov Chain models for Certain q-confluent Hypergeometric 
%   Distributions", A.W. Kemp, Journal of Stat. Planning and Inference", 
%   vol.135, 2005, p.107.
%
%  Created by Jim Huntley,  2/23/09
%

function [pdf] = qbaildaum_pdf(n, a, q)

persistent pdfhold prodlim

%if(isempty(prodlim))
    prodlim = 20/(1-q);         % heuristic.
%end

if(n == 0)
    pdfhold = 1 / (uq(-q,q,prodlim) * uq(a*q,q^2,prodlim));
    pdf = pdfhold;
elseif(n > 0)
    pdf = pdfhold * (1-a*q^(n-1))*q^n / (1-q^n);
    pdfhold = pdf;
end

return

function [prodjn] = uq(u,q,prodlim)

prodjn = 0;
for jn = 1:prodlim
    prodjn = prodjn + log((1-u*q^(jn-1)));
end
prodjn = exp(prodjn);

return

Contact us