from Anderson-Darling Goodness Of Fit Test to Inverse Gaussian Distbtn by Matthew Brenneman
Tests M random samples of N random vars to determine if they are from Inverse Gaussian distbtn.

Subr_ComputeCritVals(Shape,TableShape,TableCV,Alpha)
function [CV] = Subr_ComputeCritVals(Shape,TableShape,TableCV,Alpha)
%
%
global M
%
%
CV = zeros(1,M);                                      %   Exact Critical Value Computed from Table Using Logarithmic Interpolation from Table
MaxShapeIndex = max(TableShape);
MinShapeIndex = min(TableShape);
%
for ii = 1:M
    %
    ShapeIndex = log2(Shape(1,ii));
    %
    %
    if (ShapeIndex > MinShapeIndex) && (ShapeIndex < MaxShapeIndex)

        Index = sum(ShapeIndex > TableShape);
        yl = TableCV(Index);
        yu = TableCV(Index+1);
        xl = TableShape(Index);
        xu = TableShape(Index+1);
        IntRatio = (yu - yl)/(xu-xl);
        CV(1,ii) = yl + IntRatio*(ShapeIndex-xl);

    else

        if ShapeIndex < MinShapeIndex
            CV(1,ii) = min(TableCV);
        else
            if Alpha == 10
                CV(1,ii) = 0.63;
            end
            if Alpha == 5
                CV(1,ii) = 0.76;
            end
            if Alpha == 1
                CV(1,ii) = 1.04;
            end
        end

    end

end

Contact us at files@mathworks.com