function s=ntest1(data)

% NTEST1      Test of uni-variate normality.
%
%             Example: data=randn(100,1);
%                      s=ntest1(data);
%
%             NTEST1(DATA)
%
%             5% critical values: See Bowman and Foster(1993), pg 536
%
%             Christian C. Beardah 1996

ndata=(data-mean(data))/std(data);
h=(4/(3*length(ndata)))^0.2;
[x,y]=kdfft1(ndata,'knorm',256,h,0);
% plot(x,y);
z=npdf(x,0,sqrt(1+h^2))';
% hold on; plot(x,z,'--');
delta=x(2)-x(1);
s=delta*sum((z-y).^2);