function [h p z] = LinMudholkar(data, alpha)
%Lin-Mudholkar Test
% The Lin-Mudholkar (Lin and Mudholkar, 1980) test is based on the fact that the mean and variance
% in a random sample are independently distributed, if and only if, the
% parent population is normal
% The test is sensitive only to departures from normality due to skewness.
%
% The procedure has little power in detecting non-normal symmetrical
% distributions. For example, uniform or platykurtic distributions will pass
% this test easily. Therefore, other tests should also be consulted if there
% is a concern for this type of departure from normality.
%
% A minimum sample size of 10 is recommended for this procedure.
% Lin, C.-C., Mudholkar, G.S. (1980), A simple test for normality against asymmetric
% alternatives, Biometrika, 67, 455-61
% Henry C. Thode, JR, Testing for Normality, CRC
if nargin < 2
alpha = 0.05;
end
data=data(:);
n= length(data);
means=[]; vars=[];
for i = 1:n
x = kickith(data,i);
means=[means; mean(x)];
vars=[vars; var(x)];
end
vars13 = vars.^(1/3);
r = corr(means, vars13);
z=atanh(r); %z is asymptotically N(0, 3/n)
% but for small samples, by simulation Lin and Mudhlodar find
varz= 3/n - 7.324/n^2 + 53.005/n^3;
skewz=-11.7/n + 55.06/n^2;
a=24/skewz; b= -24*z/(sqrt(varz) * skewz);
d=roots([1 0 a b]);
p = 2*normcdf(-min(abs(d)));
h = p < alpha;
z= - min(abs(d));
%
%
function vec_i= kickith(sample, i)
% Elliminates i-th Column in sample
% Usage
% vec_i= kickith(sample, i)
% Input
% sample - original data
% i - i-th column
% Output
% vec_i - sample without i-th column
% Example
% Brani 10/20/02
[m,n] = size(sample);
if min(m,n)==1
sample=sample(:);
m=max(m,n);
end
if i == 1
vec_i = sample(2:m,:);
elseif i == n
vec_i = sample(1:(m-1),:);
else
vec_i =[ sample(1:i-1,:); sample(i+1:m,:) ];
end
%--------------Gatech Nonparametric ------------------