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

lmstat_pdf(x, r, nn, k)
% lmstat_pdf.m - evaluates a Lagrange Multipler 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] = lmstat_pdf(x, r, nn, k)

%persistent coef rd2 

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

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

return

Contact us