function anomheI(X,no,d,a)
%ANOMHEI One-way Analysis of Means with Heteroscedasticity.
%Analysis of Means (ANOM) is a statistical procedure for troubleshooting
% industrial processes and analyzing the results of experimental designs
% with factors at fixed levels. ANOM is an alternative to ANOVA for a fixed
% effects model. Unlike ANOVA only determines if there is a significant
% difference between the treatment means, ANOM identifies the means that
% are significantly different. For it is considered a class of multiple
% comparasions procedure. ANOM not only answers the question of whether or
% not there are any differences among the factor levels, but when there are
% differences, it also tell us which levels are better and which are worst.
%
% It compares the absolute deviations of group means from their overall mean,
% an approach that was initially studied by Laplace in 1827. Halperin et al.
% (1955) derived a version of this method in the form of a multiple
% significance test in 1955. Ott (1967, 1975) developed a graphical
% representation for the test and introduced the term 'analysis of means'.
% Nelson (1982) and Nelson (1983) provided exact critical values for ANOM
% when the groups have equal sample sizes (balanced).
%
% According to Nelson et al. (2005), basically, an ANOM is the generation
% of a decison chart similar in appearance to a control chart. It has a
% centerline, located at the overall mean, rate or proportion, and upper
% and lower decision limits. The group means, rate or proportions are
% plotted, and those that fall beyond the decision limits are said to be
% significantly diferent from the overall value. These differences are
% statistical diferences, if they exist. Then, ANOM allows one to easily
% evaluate the practical differences.
%
% This m-file considers, according to Nelson and Dudewicz (2002) and
% Dudewics and Nelson (2003), the heteroscedastic situation where different
% processes do not necessarily have equal variances. These new results
% allow an experimenter to set a goal of detecting differences among the k
% treatment means when two of them differ by at least a specified amound d,
% which does not depend on the possibly different) standard eviations of
% the processes. In order to review the statistic fundamentals of this
% procedure, see Nelson and Dudewicz (2002) and Dudewics and Nelson (2003).
%
% It is considered the errors of the treatments being compared are normally
% distributed with unequal variances, and all the observations are
% independent.
%
% This statistical procedure it is also known in the literature as HANOM.
%
% You can find the ANOM balanced (ANOMBAL) and unbalanced (ANOMUNBAL)
% m-files in this same FEX page.
%
% Syntax: function anomheI(X,no,d,a)
%
% Inputs:
% X - data matrix (Size of matrix must be n-by-2; sample=column 1,
% data=column 2)
% no - initial sample size for the first-stage
% d - amount that any two treatment means differing by it will lead
% to rejection of the null hypothesis
% a - significance level (default = 0.05)
%
% Outputs:
% - Complete one-way heteroscedastic Analysis of Means
% - ANOMHEI chart
%
% Example: From the example 2.1 (Dudewicz and Nelson, 2003, p.146,160-161)
% we are interested to test the effects of four different solvents on the
% ability of the fungicide M2BC to destroy the fungus Penicillum expansum,
% considering different variances (heteroscedasticity). An initial samples
% size no=15 were taken to each of the solvents, a difference between any
% two tratment means d=sqrt(2), and a significance-level of 0.1.
% The data are:
% Solvent
% --------------------------------
% 1 2 3 4
% --------------------------------
% 96.44 93.63 93.58 97.18
% 96.87 93.99 93.02 97.42
% 97.24 94.61 93.86 97.65
% 95.41 91.69 92.90 95.90
% 95.29 93.00 91.43 96.35
% 95.61 94.17 92.68 97.13
% 95.28 92.62 91.57 96.06
% 94.63 93.41 92.87 96.33
% 95.58 94.67 92.65 96.71
% 98.20 95.28 95.31 98.11
% 98.29 95.13 95.33 98.38
% 98.30 95.68 95.17 98.35
% 98.65 97.52 98.59 98.05
% 98.43 97.52 98.00 98.25
% 98.41 97.37 98.79 98.12
% ... ... ... 97.97
% ... ... ...
% 97.41 93.86 93.29
% 97.52 92.57 94.21
% ... ...
% ... ...
% 98.35 95.95
% 97.09 97.79
% ...
% 94.96
% 94.34
% --------------------------------
%
% Data matrix must be:
% X=[1 96.44;1 96.87;1 97.24;1 95.41;1 95.29;1 95.61;1 95.28;1 94.63;1 95.58;1 98.20;1 98.29;1 98.30;
% 1 98.65;1 98.43;1 98.41;1 98.59;1 98.20;1 98.37;1 98.57;1 98.42;1 98.29;1 98.51;1 98.89;1 98.66;
% 1 97.39;1 97.41;1 97.52;2 93.63;2 93.99;2 94.61;2 91.69;2 93.00;2 94.17;2 92.62;2 93.41;2 94.67;
% 2 95.28;2 95.13;2 95.68;2 97.52;2 97.52;2 97.37;2 96.97;2 97.21;2 97.44;2 96.86;2 97.26;2 98.27;
% 2 97.57;2 97.81;2 98.20;2 93.92;2 93.86;2 92.57;2 93.32;2 92.15;2 92.09;2 94.03;2 92.43;2 92.62;
% 2 94.47;2 94.14;2 93.09;2 98.47;2 98.06;2 98.35;2 97.09;3 93.58;3 93.02;3 93.86;3 92.90;3 91.43;
% 3 92.68;3 91.57;3 92.87;3 92.65;3 95.31;3 95.33;3 95.17;3 98.59;3 98.00;3 98.79;3 96.36;3 96.69;
% 3 96.89;3 96.13;3 97.65;3 97.81;3 97.71;3 97.48;3 97.96;3 94.30;3 93.29;3 94.21;3 92.90;3 93.02;
% 3 93.43;3 93.43;3 92.72;3 93.56;3 94.13;3 93.57;3 96.27;3 98.05;3 97.67;3 98.93;3 97.23;3 95.95;
% 3 97.79;3 97.41;3 96.94;3 97.08;3 98.15;3 96.73;3 97.55;3 94.44;3 93.61;3 93.61;3 94.20;3 94.20;
% 3 93.34;3 93.33;3 93.51;3 93.91;3 94.05;3 93.76;3 93.76;3 92.42;3 92.38;3 92.06;3 92.50;3 92.54;
% 3 92.52;3 91.80;3 93.00;3 91.69;3 95.42;3 92.29;3 92.57;3 94.96;3 94.34;4 97.18;4 97.42;4 97.65;
% 4 95.90;4 96.35;4 97.13;4 96.06;4 96.33;4 96.71;4 98.11;4 98.38;4 98.35;4 98.05;4 98.25;4 98.12;
% 4 97.97];
%
% Calling on Matlab the function:
% anomheI(X,15,sqrt(2),0.1)
% Answer is:
%
% The number of treatments are: 4
%
% Summary statistics from the first-stage samples.
% --------------------------------------------------
% Sample Size Mean Variance
% --------------------------------------------------
% 1 15 96.8420 2.1099
% 2 15 94.6860 3.1709
% 3 15 94.3833 5.8843
% 4 15 97.3327 0.7797
% --------------------------------------------------
%
% Statistics computed using the second-stage samples.
% ---------------------------------------------------------
% Sample Size Mean b m
% ---------------------------------------------------------
% 1 27 98.2350 0.5210 97.5677
% 2 40 95.5300 0.6714 95.2527
% 3 74 94.8339 0.8286 94.7567
% 4 16 97.9700 0.2564 97.4961
% ---------------------------------------------------------
%
% There were significant samples.
% ----------------------
% Above the upper limit:
% -----------------------------------------------
% 1 4
% -----------------------------------------------
% ----------------------
% Below the upper limit:
% -----------------------------------------------
% 2 3
% -----------------------------------------------
%
% Created by A. Trujillo-Ortiz, R. Hernandez-Walls, F.A. Trujillo-Perez
% and N. Castro-Castro
% Facultad de Ciencias Marinas
% Universidad Autonoma de Baja California
% Apdo. Postal 453
% Ensenada, Baja California
% Mexico.
% atrujo@uabc.mx
% Copyright. August 20, 2009.
%
% To cite this file, this would be an appropriate format:
% Trujillo-Ortiz, A., R. Hernandez-Walls, F.A. Trujillo-Perez and
% N. Castro-Castro (2009). anomheI:One-way Analysis of Means with
% Heteroscedasticity. A MATLAB file. [WWW document]
% URL http://www.mathworks.com/matlabcentral/fileexchange/25114
%
% --We deeply thank Dr. Edward J. Dudewicz for sent us the hard copies of
% some valuable papers here used.---
%
% References:
% Dudewicz, E.J. and P.R. Nelson. (2003), Heteroscedastic Analysis of Means
% HANOM. Am. J. Math. Manag. Sci. 23(1-2):143-181.
% Halperin, M., S.W. Greenhouse, J Cornfield, and J. Zalokar. (1955),
% Tables of percentage points for the studentized maximum absolute
% deviate in normal samples. J. Amer. Statist. Ass. 50:185-195.
% Nelson, P.R. (1982), Exact Critical Points for the Analysis of Means.
% Communications in Statistics-Theory and Methods 11(6):699-709.
% Nelson, L.S. (1983), Exact critical values for use with the Analysis of
% Means. Journal of Quality Technology, 15:40-44.
% Nelson, P.R. and E.J. Dudewicz. (2002), Exact Analysis of Means with
% Unequal Variances. Technometrics, 44(2):152-160.
% Nelson, P.R., P.S. Wludyka, and K. Copeland. (2005), The Analysis of
% Means: A Graphical Method for Comparing Means, Rates, and Proportions,
% ASA-SIAM Series in Statistics and Applied Probability 18.
% Ott, E.R. (1967), Analysis of MeansA Graphical Procedure, Industrial
% Quality Control, 24: 101109. Reprinted in Journal of Quality
% Technology, (1983), 15:1018.
% Ott, E.R. (1975), Process Quality Control:Troubleshooting and
% Interpretation of Data. New York:McGraw-Hill.
%
if nargin < 4 || isempty(a)
a = 0.05; %default
elseif numel(a) ~= 1 || a <= 0 || a >= 1
error('stats:anomheI:BadAlpha','ALPHA must be a scalar between 0 and 1.');
end
if nargin < 3
error('stats:anomheI:TooFewInputs',...
'Requires at least three input arguments.');
end
if (no(no <= 0 | round(no) ~= no) ~= NaN)
error('stats:anomheI:BadValue','Initial sample size (no) must be an integer.');
end
c = size(X,2);
if c ~= 2
error('stats:anomheI:BadData','X must have two colums.');
end
t = max(X(:,1));
fprintf('The number of treatments are:%2i\n', t);
v = no - 1; %degrees of freedom
%f=first-stage;s=second-stage
nT=[];nTf=[];mTf=[];vTf=[];mTs=[];
indice = X(:,1);
for k = 1:t
Xe = find(indice==k);
eval(['T' num2str(k) '=X(Xe,2);']);
eval(['nx =length(T' num2str(k) ');']);
eval(['nxf =length(T' num2str(k) '(1:no));']);
eval(['mxf =mean(T' num2str(k) '(1:no));']);
eval(['mxs =mean(T' num2str(k) '(no+1:end));']);
eval(['vxf =var(T' num2str(k) '(1:no));']);
nT=[nT,nx];nTf=[nTf,nxf];mTf=[mTf,mxf];vTf=[vTf,vxf];mTs=[mTs,mxs];
end
N = sum(nT); %total number of observations
w = fix(mean(round(d*sqrt((nT - 1)./vTf)))); %approximate w value based on
%desired sample sizes
b = ((nT-nTf)./nT).*(1 + sqrt((nTf./(nT-nTf)).*(((d/w)^2)*(nT./vTf)-1)));
m = ((1 - b).*mTf) + b.*mTs;
M = mean(m);
%critical values for alpha-value=0.01,0.05,and 0.10. For samples k=2 to 20.
I = t-1;
if (a == 0.01);
if ((1 <= v) & (v <= 20));
h = [63.6 128.0 190.0 253.0 318.0 381.0 446.0 508.0 570.0 634.0 698.0 758.0 824.0 885.0 950.0 1015.0 1077.0 1145.0 1210.0
7.24 11.7 15.1 18.0 20.5 22.7 24.9 26.8 28.5 30.2 31.9 33.3 34.8 36.3 37.7 38.9 40.2 41.4 42.6
3.95 5.89 7.21 8.24 9.15 9.88 10.5 11.1 11.7 12.2 12.6 13.1 13.4 13.8 14.2 14.5 14.8 15.2 15.5
3.07 4.37 5.20 5.83 6.34 6.77 7.15 7.49 7.78 8.05 8.30 8.53 8.75 8.95 9.13 9.31 9.47 9.64 9.80
2.69 3.74 4.38 4.85 5.22 5.53 5.79 6.04 6.24 6.43 6.59 6.75 6.89 7.03 7.15 7.27 7.39 7.50 7.59
2.48 3.41 3.93 4.32 4.63 4.87 5.08 5.26 5.42 5.58 5.71 5.83 5.94 6.04 6.13 6.23 6.31 6.39 6.46
2.35 3.20 3.66 4.01 4.27 4.47 4.65 4.81 4.95 5.08 5.19 5.28 5.38 5.46 5.54 5.61 5.69 5.76 5.82
2.27 3.06 3.48 3.79 4.02 4.21 4.36 4.50 4.63 4.73 4.83 4.92 4.99 5.07 5.14 5.20 5.26 5.32 5.38
2.20 2.96 3.35 3.63 3.84 4.01 4.16 4.29 4.40 4.50 4.59 4.66 4.74 4.80 4.86 4.92 4.97 5.02 5.08
2.15 2.88 3.25 3.52 3.72 3.87 4.01 4.13 4.23 4.32 4.40 4.47 4.53 4.59 4.65 4.70 4.75 4.79 4.85
2.12 2.83 3.18 3.42 3.61 3.77 3.89 4.00 4.10 4.18 4.25 4.33 4.38 4.44 4.49 4.54 4.59 4.63 4.66
2.08 2.78 3.12 3.36 3.53 3.67 3.80 3.90 3.99 4.07 4.14 4.20 4.26 4.31 4.36 4.41 4.45 4.49 4.53
2.06 2.74 3.07 3.30 3.47 3.61 3.72 3.82 3.91 3.98 4.05 4.11 4.17 4.22 4.26 4.30 4.35 4.38 4.42
2.04 2.71 3.03 3.25 3.42 3.55 3.66 3.75 3.83 3.91 3.97 4.03 4.08 4.13 4.17 4.21 4.25 4.29 4.33
2.02 2.69 3.00 3.21 3.37 3.50 3.61 3.70 3.78 3.85 3.91 3.96 4.01 4.06 4.11 4.14 4.18 4.22 4.25
2.01 2.67 2.97 3.17 3.34 3.46 3.56 3.65 3.72 3.79 3.85 3.91 3.95 4.00 4.04 4.08 4.11 4.15 4.18
1.99 2.64 2.94 3.14 3.30 3.42 3.52 3.61 3.68 3.75 3.81 3.86 3.91 3.95 3.99 4.02 4.06 4.09 4.13
1.98 2.62 2.93 3.12 3.27 3.39 3.49 3.58 3.65 3.71 3.77 3.82 3.87 3.91 3.94 3.98 4.01 4.05 4.08
1.98 2.61 2.90 3.10 3.25 3.37 3.46 3.54 3.62 3.68 3.73 3.78 3.83 3.87 3.91 3.94 3.97 4.01 4.04
1.96 2.59 2.89 3.08 3.23 3.34 3.44 3.52 3.59 3.65 3.71 3.75 3.80 3.83 3.87 3.91 3.94 3.97 4.00];
h = h(v,I);
elseif ((20 < v) & (v <= 24)),
h = [1.94 2.55 2.83 3.02 3.16 3.26 3.36 3.43 3.50 3.56 3.61 3.65 3.70 3.73 3.77 3.80 3.83 3.86 3.89];
h = h(I);
elseif ((24 < v) & (v <= 30)),
h = [1.91 2.51 2.79 2.96 3.09 3.20 3.28 3.35 3.41 3.47 3.52 3.56 3.60 3.63 3.67 3.70 3.73 3.75 3.77];
h = h(I);
elseif ((30 < v) & (v <= 40)),
h = [1.89 2.48 2.74 2.91 3.03 3.13 3.21 3.27 3.33 3.38 3.43 3.47 3.51 3.54 3.57 3.60 3.62 3.65 3.67];
h = h(I);
elseif ((40 < v) & (v <= 60)),
h = [1.86 2.44 2.69 2.85 2.97 3.07 3.14 3.20 3.26 3.31 3.35 3.38 3.42 3.45 3.47 3.50 3.53 3.55 3.57];
h = h(I);
elseif ((60 < v) & (v <= 120)),
h = [1.84 2.41 2.64 2.80 2.92 3.00 3.07 3.13 3.18 3.23 3.27 3.30 3.33 3.36 3.39 3.41 3.44 3.45 3.48];
h = h(I);
else v > 120,
h = [1.82 2.38 2.61 2.76 2.87 2.95 3.01 3.07 3.12 3.16 3.20 3.23 3.26 3.28 3.31 3.33 3.35 3.37 3.39];
h = h(I);
end
elseif (a == 0.05);
if ((1 <= v) & (v <= 20));
h = [12.7 25.3 37.8 5.1 62.5 74.7 87.1 99.4 112.0 125.0 137.0 15.0 162.0 175.0 187.0 200.0 212.0 225.0 237.0
3.28 5.24 6.72 7.97 9.07 10.0 11.0 11.8 12.6 13.3 14.0 14.7 15.35 16.0 16.6 17.2 17.7 18.3 18.8
2.29 3.43 4.17 4.75 5.25 5.67 6.05 6.40 6.71 7.00 7.28 7.53 7.76 7.99 8.20 8.39 8.58 8.77 8.94
1.97 2.86 3.39 3.80 4.13 4.41 4.65 4.87 5.07 5.25 5.41 5.57 5.70 5.83 5.96 6.08 6.19 6.30 6.40
1.81 2.60 3.04 3.37 3.62 3.84 4.03 4.20 4.35 4.49 4.61 4.72 4.82 4.91 5.01 5.09 5.18 5.25 5.33
1.72 2.45 2.83 3.12 3.34 3.52 3.68 3.82 3.95 4.06 4.16 4.25 4.34 4.42 4.49 4.56 4.62 4.69 4.75
1.66 2.35 2.71 2.96 3.16 3.33 3.46 3.59 3.70 3.80 3.89 3.97 4.04 4.11 4.17 4.23 4.29 4.34 4.39
1.62 2.29 2.62 2.86 3.04 3.19 3.32 3.43 3.53 3.62 3.69 3.77 3.83 3.89 3.95 4.00 4.06 4.10 4.15
1.59 2.24 2.55 2.78 2.95 3.09 3.21 3.31 3.40 3.48 3.56 3.62 3.69 3.74 3.79 3.84 3.89 3.93 3.97
1.56 2.20 2.50 2.71 2.88 3.01 3.13 3.22 3.31 3.39 3.45 3.52 3.57 3.63 3.67 3.72 3.76 3.80 3.84
1.55 2.17 2.46 2.67 2.83 2.96 3.06 3.15 3.24 3.31 3.37 3.43 3.49 3.54 3.58 3.62 3.66 3.70 3.74
1.53 2.14 2.43 2.63 2.78 2.91 3.01 3.10 3.18 3.24 3.31 3.36 3.41 3.46 3.51 3.55 3.58 3.62 3.65
1.52 2.12 2.40 2.60 2.75 2.87 2.97 3.06 3.13 3.19 3.25 3.31 3.36 3.40 3.44 3.48 3.52 3.56 3.59
1.51 2.10 2.38 2.57 2.72 2.83 2.93 3.02 3.09 3.15 3.21 3.26 3.31 3.35 3.39 3.43 3.47 3.50 3.53
1.50 2.09 2.36 2.55 2.69 2.81 2.90 2.98 3.05 3.12 3.17 3.22 3.27 3.31 3.35 3.39 3.42 3.45 3.48
1.49 2.08 2.35 2.53 2.67 2.78 2.88 2.96 3.02 3.09 3.14 3.19 3.24 3.28 3.32 3.35 3.38 3.42 3.44
1.48 2.07 2.33 2.52 2.65 2.76 2.85 2.93 3.00 3.06 3.11 3.16 3.21 3.25 3.28 3.32 3.35 3.38 3.41
1.48 2.06 2.32 2.50 2.64 2.75 2.84 2.91 2.98 3.04 3.09 3.14 3.18 3.22 3.26 3.29 3.32 3.35 3.38
1.47 2.05 2.31 2.49 2.62 2.73 2.82 2.89 2.96 3.02 3.07 3.12 3.16 3.20 3.23 3.27 3.30 3.33 3.36
1.47 2.04 2.30 2.48 2.61 2.72 2.80 2.88 2.94 3.00 3.05 3.10 3.14 3.17 3.21 3.25 3.28 3.31 3.33];
h = h(v,I);
elseif ((20 < v) & (v <= 24)),
h = [1.45 2.02 2.27 2.44 2.57 2.67 2.76 2.83 2.89 2.94 2.99 3.04 3.08 3.11 3.15 3.18 3.21 3.23 3.26];
h = h(I);
elseif ((24 < v) & (v <= 30)),
h = [1.44 2.00 2.24 2.41 2.53 2.63 2.71 2.78 2.84 2.89 2.94 2.98 3.01 3.05 3.08 3.11 3.14 3.16 3.19];
h = h(I);
elseif ((30 < v) & (v <= 40)),
h = [1.43 1.98 2.22 2.38 2.50 2.59 2.67 2.73 2.79 2.84 2.88 2.92 2.96 2.99 3.02 3.05 3.07 3.10 3.12];
h = h(I);
elseif ((40 < v) & (v <= 60)),
h = [1.41 1.95 2.19 2.35 2.46 2.55 2.63 2.69 2.74 2.79 2.83 2.87 2.90 2.93 2.96 2.99 3.01 3.04 3.06];
h = h(I);
elseif ((60 < v) & (v <= 120)),
h = [1.40 1.93 2.16 2.31 2.43 2.51 2.58 2.64 2.70 2.74 2.78 2.82 2.85 2.88 2.90 2.93 2.95 2.97 3.00];
h = h(I);
else v > 120,
h = [1.39 1.91 2.14 2.29 2.39 2.48 2.54 2.60 2.65 2.70 2.73 2.77 2.80 2.83 2.85 2.88 2.90 2.92 2.94];
h = h(I);
end
else (a == 0.10);
if ((1 <= v) & (v <= 20));
h = [6.32 12.5 18.5 24.5 30.6 36.7 42.9 48.9 54.9 61.0 66.9 73.0 79.0 85.1 91.0 97.2 103.0 109.0 115.0
2.28 3.69 4.69 5.56 6.32 7.01 7.65 8.23 8.78 9.30 9.79 10.3 10.7 11.1 11.6 11.9 12.3 12.7 13.1
1.75 2.68 3.24 3.70 4.08 4.42 4.71 4.98 5.23 5.46 5.67 5.87 6.05 6.22 6.39 6.55 6.70 6.85 6.99
1.55 2.33 2.76 3.10 3.37 3.61 3.81 3.99 4.16 4.30 4.44 4.57 4.69 4.80 4.91 5.00 5.10 5.19 5.27
1.45 2.16 2.53 2.81 3.04 3.23 3.39 3.53 3.66 3.78 3.88 3.98 4.07 4.16 4.24 4.32 4.39 4.45 4.52
1.39 2.06 2.40 2.65 2.85 3.01 3.15 3.27 3.38 3.48 3.57 3.65 3.73 3.80 3.87 3.93 3.99 4.05 4.10
1.36 1.99 2.31 2.54 2.72 2.87 3.00 3.11 3.20 3.29 3.37 3.45 3.52 3.58 3.64 3.69 3.74 3.79 3.84
1.33 1.94 2.25 2.46 2.63 2.77 2.89 2.99 3.08 3.16 3.23 3.30 3.36 3.42 3.47 3.52 3.57 3.61 3.66
1.31 1.91 2.20 2.41 2.57 2.70 2.81 2.91 2.99 3.06 3.13 3.20 3.25 3.31 3.35 3.40 3.44 3.48 3.52
1.29 1.88 2.17 2.37 2.52 2.65 2.75 2.84 2.92 2.99 3.06 3.12 3.17 3.22 3.26 3.31 3.35 3.39 3.42
1.28 1.86 2.14 2.33 2.48 2.60 2.70 2.79 2.87 2.94 3.00 3.05 3.10 3.15 3.19 3.24 3.27 3.31 3.34
1.27 1.84 2.12 2.31 2.45 2.57 2.67 2.75 2.82 2.89 2.95 3.00 3.05 3.10 3.14 3.18 3.21 3.25 3.28
1.26 1.83 2.10 2.28 2.42 2.54 2.63 2.72 2.79 2.85 2.91 2.96 3.01 3.05 3.09 3.13 3.16 3.20 3.23
1.25 1.82 2.08 2.26 2.40 2.51 2.61 2.69 2.76 2.82 2.88 2.93 2.97 3.01 3.05 3.09 3.12 3.16 3.19
1.24 1.81 2.07 2.25 2.38 2.49 2.59 2.66 2.73 2.79 2.85 2.90 2.94 2.98 3.02 3.06 3.09 3.12 3.15
1.24 1.80 2.06 2.23 2.37 2.48 2.57 2.65 2.71 2.77 2.82 2.87 2.91 2.96 2.99 3.03 3.06 3.09 3.12
1.23 1.79 2.05 2.22 2.35 2.46 2.55 2.63 2.69 2.75 2.80 2.85 2.89 2.93 2.97 3.00 3.03 3.07 3.09
1.23 1.78 2.04 2.21 2.34 2.45 2.54 2.61 2.68 2.73 2.79 2.83 2.87 2.91 2.95 2.98 3.01 3.04 3.07
1.23 1.78 2.03 2.20 2.33 2.44 2.52 2.60 2.66 2.72 2.77 2.81 2.85 2.89 2.93 2.96 2.99 3.02 3.05
1.22 1.77 2.02 2.19 2.32 2.43 2.51 2.59 2.65 2.70 2.75 2.80 2.84 2.88 2.91 2.95 2.98 3.00 3.03];
h = h(v,I);
elseif ((20 < v) & (v <= 24)),
h = [1.21 1.76 2.00 2.17 2.29 2.39 2.48 2.55 2.61 2.66 2.71 2.75 2.79 2.83 2.86 2.89 2.92 2.95 2.97];
h = h(I);
elseif ((24 < v) & (v <= 30)),
h = [1.20 1.74 1.98 2.14 2.26 2.36 2.44 2.51 2.57 2.62 2.67 2.71 2.75 2.78 2.81 2.84 2.87 2.89 2.92];
h = h(I);
elseif ((30 < v) & (v <= 40)),
h = [1.19 1.72 1.96 2.12 2.24 2.33 2.41 2.47 2.53 2.58 2.62 2.66 2.70 2.73 2.76 2.79 2.82 2.84 2.87];
h = h(I);
elseif ((40 < v) & (v <= 60)),
h = [1.18 1.71 1.94 2.09 2.21 2.30 2.38 2.44 2.49 2.54 2.58 2.62 2.66 2.69 2.72 2.74 2.77 2.79 2.81];
h = h(I);
elseif ((60 < v) & (v <= 120)),
h = [1.17 1.69 1.92 2.07 2.18 2.27 2.34 2.40 2.46 2.50 2.54 2.58 2.61 2.64 2.67 2.70 2.72 2.74 2.77];
h = h(I);
else v > 120,
h = [1.16 1.68 1.90 2.05 2.15 2.24 2.31 2.37 2.42 2.47 2.50 2.54 2.57 2.60 2.63 2.65 2.68 2.70 2.72];
h = h(I);
end
end
disp(' ')
disp('Summary statistics from the first-stage samples.')
disp('--------------------------------------------------')
disp(' Sample Size Mean Variance ')
disp('--------------------------------------------------')
for k = 1:t
fprintf(' %d %i %.4f %.4f\n',k,nTf(k),mTf(k),vTf(k))
end
disp('--------------------------------------------------')
disp(' ')
disp('Statistics computed using the second-stage samples.')
disp('----------------------------------------------------------')
disp(' Sample Size Mean b m ')
disp('----------------------------------------------------------')
for k = 1:t
fprintf(' %d %i %.4f %.4f %.4f\n',k,nT(k),mTs(k),b(k),m(k))
end
disp('----------------------------------------------------------')
disp(' ')
UDL = M + h*(d/w); %upper decision limits
LDL = M - h*(d/w); %lower decision limits
A = [];
for k = 1:t,
if m(k) >= UDL;
x = 1;
elseif ((LDL < m(k)) & (m(k) < UDL))
x = 0;
else m(k) <= LDL;
x =- 1;
end
A = [A x];
end
U = (A == 1.0);
L = (A == -1.0);
O = (A == 0.0);
s = 1:t;
ab = s(U);
be = s(L);
ns = s(O);
if sum(O)==k,
disp('There were no significant samples.')
else
disp('There were significant samples.')
if sum(U)>0,
disp('----------------------')
disp('Above the upper limit:')
disp('------------------------------------------------')
fprintf(' %d\t',ab')
fprintf(' \n')
disp('------------------------------------------------')
else
end
if sum(L)>0,
disp('----------------------')
disp('Below the upper limit:')
disp('------------------------------------------------')
fprintf(' %d\t',be')
fprintf(' \n')
disp('------------------------------------------------')
else
end
if sum(O)>0,
disp('----------------------')
disp('Remaining samples were no significant:')
disp('------------------------------------------------')
fprintf(' %d\t',ns)
fprintf(' \n')
disp('------------------------------------------------')
else
end
end
disp (' ')
plot((1:t),ones(1,t)*UDL,'r-',(1:t),ones(1,t)*LDL,'r--','LineWidth',2)
hold on
plot((1:t),m,'*b')
plot((1:t),ones(1,t)*M,'-k')
stem((1:t),m,'BaseValue',M)
xlabel('Sample');
ylabel('Mean of the Measurement (DV)');
st1 = (['(alpha-level = ',num2str(a) ', ' 'samples = ',num2str(t) ', ' 'N = ',...
num2str(N) ', ' 'UDL = ',num2str(UDL) ', ' 'LDL = ',num2str(LDL) ', no = ',...
num2str(no) ', ' 'd = ',num2str(d) ', ' 'w = ',num2str(w) ')']);
title({'Analysis of Means chart for comparing differences between heteroscedastic samples.',...
'' num2str(st1) ''})
if any (m > UDL),
U = max(m);
U = U+(U*0.005);
else
U = UDL;
U = U+(U*0.005);
end
if any (m < LDL),
L = min(m);
L = L-(L*0.005);
else
L = LDL;
L = L-(L*0.005);
end
axis([.8 t+.2 L U])
h = figure(gcf);
h2 = get(h,'CurrentAxes');
h4 = get(h2,'XTickLabel');
for k = 1:length(h4),
if ~isempty(strfind(h4(k,:),'.')),
h4(k,:) = ' ';
end
end
set(h2,'XTickLabel',h4)
hold off
return,