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

skewpe_pdf(x, mu, sigma, nu, lambda)
% skewpe_pdf.m - evaluates a Skew Exponential Probability Density.
%   See "Skew Scale Mixture of Normal Distributions: Properties and Estimation",
%   C. da Silva Ferreira, H. Bolfarine (Sao Paolo), V. H. Lachos. 
%
%   Vector form of PDF!!!
%
%  Created by Jim Huntley,  11/20/07
%
%   Calls: 'gaus_cdf.m'
%

function [pdf] = skewpe_pdf(x, mu, sigma, nu, lambda)

%persistent coef

%if(isempty(coef))
    %coef = 2 * nu / (2^(0.5/nu) * sigma * gamma(0.5/nu));
    coef = log(2 * nu) - (0.5/nu)*log(2) - log(sigma) - gammaln(0.5/nu);
%end

d = (x - mu).^2 ./ sigma^2;

for jx = 1:size(x,2)
    omega = lambda * (x(jx)-mu) / sigma;
    %pdf(jx) = coef * exp(-0.5.*(d(jx))^nu) * gaus_cdf(omega,0,1);
    pdf(jx) = exp(coef - 0.5.*(d(jx))^nu + log(gaus_cdf(omega,0,1)));
end

return

Contact us