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

sz_pdf(x, n)
% sz_pdf.m - evaluates a Student's Z Product Probability Density.
%   See "Student's z-Distribution",
%  Vector Form of PDF.
%  Created by Jim Huntley,  11/04/05

function [pdf] = sz_pdf(x, n)

%persistent nd2 gamlnnd2 lrtpi gamln2

    nd2 = n/2;
    gamlnnd2 = gammaln(nd2);
    lrtpi = log(sqrt(pi));
    gamln2 = gammaln(nd2-0.5);
pdf = exp(gamlnnd2 + log((1+x.^2).^(-nd2)) - (lrtpi + gamln2));


Contact us