Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates


James Huntley (view profile)


generates random variates from over 870 univariate distributions

invchisq_pdf(x, nu)
% invchisq_pdf.m - evaluates an Inverse Chi-Square Probability Density.
%   See "Inverse Chi-Square Distribution", Wikipedia.
%  Created by Jim Huntley,  08/03/06

function [pdf] = invchisq_pdf(x, nu)

%persistent arg l2arg gamlnarg

    arg = 0.5*nu;
    l2arg = log(2^(-arg));
    gamlnarg = gammaln(arg);
pdf = exp(l2arg + log(x^(-arg-1)) - 0.5/x - gamlnarg);


Contact us