function ADStat = adstatnormcdf(x)
%ADSTATNORMCDF Anderson-Darling statistic under the standard normal cdf.

x = sort(x(:));
n = numel(x);
w = 2*(1:n) - 1;
ADStat = -w*(lognormcdf(x,-1)+ lognormcdf(x(end:-1:1),1))/n - n;
