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

lrstat_pdf(x, r, nn, k)
% lrstat_pdf.m - evaluates a Likelihood Ratio-Statistic Probability Density.
%   See "An Exact, Unified Distributional Characterization of
%   Statistics used to Test Linear Hypotheses in Simple Regression
%   Models", T. Parker, 20 May, 2010. 
%
%  Created by Jim Huntley,  10/18/11
%

function [pdf] = lrstat_pdf(x, r, nn, k)

%persistent coef rd2 nmk

%if(isempty(coef))
    rd2 = 0.5 * r;
    nmk = nn - k;
    coef = 1 / (nn .* beta(nmk/2,rd2));
%end

argx = exp(x./nn);
pdf = coef .* argx .*(argx-1).^(rd2-1) ./ (argx.^((r+nmk)/2));

return

Contact us