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

tsslope_pdf(x, alpha, theta, a, b)
% tsslope_pdf.m - evaluates a Two-Sided Slope Probability Density.
%   See "Dataplot Reference Manual", Vol.1, Aux., NIST, TSSPDF.
%
%   Vector Form of the PDF!!!
%
%  Created by Jim Huntley,  01/13/10
%

function [pdf] = tsslope_pdf(x, alpha, theta, a, b)

%persistent omth bma

%if(isempty(bma))
    omth = 1 - theta;
    bma = b - a;
%end

for jx = 1:size(x,2)
    arg = (x(jx) - a) / bma;
    if(arg > theta)
        pdf(jx) = (alpha + 2*(1-alpha)*(1-arg)/omth)/bma;
        %cdf(jx) = 1 - (alpha*(1-arg) + (1-alpha)*(1-arg)^2/omth);
    elseif(arg <= theta)
        pdf(jx) = (alpha + 2*(1-alpha)*arg/theta)/bma;
        %cdf(jx) = (alpha*arg + (1-alpha)*arg^2/theta);
    end
end        

return

Contact us