Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates

by

James Huntley (view profile)

 

generates random variates from over 870 univariate distributions

stsp_pdf(x, theta, n)
% stsp_pdf.m - evaluates a Standard Two-Sided Power Probability Density.
%               See "VGAM Family Functions for Univariate Distributions", 
%               Beta Version 0.5-15, T. W. Yee, Univserity of Aukland, 
%               1/06/2004, www.stat.auckland.ac.nz/~yee/VGAM/doc/univar.pdf
%
%   Vector Form of PDF !!!
%
%  Created by Jim Huntley,  03/19/05
%

function [pdf] = stsp_pdf(x, theta, n)

for jx = 1:size(x,2)
    pdf(jx) = 0;
    if(x(jx) > 0 & x(jx) <= theta)
        pdf(jx) = n*(x(jx)/theta)^(n-1);
    end
    if(x(jx) > theta & x(jx) < 1)
        pdf(jx) = n*((1-x(jx))/(1-theta))^(n-1);
    end
end 

return

Contact us