Home > wafo > wstats > nplot.m

# nplot

## PURPOSE

Normal probability plot of effects

## SYNOPSIS

h= nplot(ef,id,offset)

## DESCRIPTION

 NPLOT Normal probability plot of effects

CALL:  nplot(ef,id)

ef = vector of average response, main effects and interaction effects
in the order given in id.
id = identification vector of main and interaction effects.
(default is standard order as given from the output of YATES)

Two problems arise in the assessment of effects from unreplicated
factorials: 1) occassionally real and meaningful high-order
interactions occur, and 2) it is necessary to allow for selection.
However, NPLOT by which effects are plotted on normal probability paper
often provides an effective way of overcoming both difficulties.

In the example below 3 effects with effects close to zero fit
reasonably on a straight line. Those corresponding to A, B and AC do
not. Conclusion: these effects are not easily explained as chance of
occurences.

Example:
y = [60 72 54 68 52 83 45 80]; % Responses to design D.
[ef,id] = yates(y);
nplot(ef,id)

See also  yates

## CROSS-REFERENCE INFORMATION

This function calls:
 range Calculates the difference between the maximum and minimum values. wnorminv Inverse of the Normal distribution function yates Calculates main and interaction effects using Yates' algorithm. cat Concatenate arrays. cellstr Create cell array of strings from character array. deal Deal inputs to outputs. diff Difference and approximate derivative. error Display message and abort function. hold Hold current graph. mean Average or mean value. num2str Convert number to string. (Fast version) plot Linear plot. text Text annotation. xlabel X-axis label. ylabel Y-axis label.
This function is called by:

## SOURCE CODE

001 function h= nplot(ef,id,offset)
002 %NPLOT Normal probability plot of effects
003 %
004 % CALL:  nplot(ef,id)
005 %
006 %  ef = vector of average response, main effects and interaction effects
007 %       in the order given in id.
008 %  id = identification vector of main and interaction effects.
009 %       (default is standard order as given from the output of YATES)
010 %
011 % Two problems arise in the assessment of effects from unreplicated
012 % factorials: 1) occassionally real and meaningful high-order
013 % interactions occur, and 2) it is necessary to allow for selection.
014 % However, NPLOT by which effects are plotted on normal probability paper
015 % often provides an effective way of overcoming both difficulties.
016 %
017 % In the example below 3 effects with effects close to zero fit
018 % reasonably on a straight line. Those corresponding to A, B and AC do
019 % not. Conclusion: these effects are not easily explained as chance of
020 % occurences.
021 %
022 % Example:
023 %   y = [60 72 54 68 52 83 45 80]; % Responses to design D.
024 %   [ef,id] = yates(y);
025 %   nplot(ef,id)
026 %
028
029 % Reference
030 % Daniel, C. (1959)
031 % Use of half-normal plot in interpreting factorial two-level
032 % experiments, Technimetrics, Vol 1, No 149.
033 % Daniel, C. (1976)
034 % Applications of statistics to Industrial Experimentation.
035
036 error(nargchk(1,3,nargin))
037 sz = size(ef);
038 n  = length(ef);
039 if prod(sz)==n,
040   ef = ef(:);
041 else
042   n = sz(1);
043 end
044
045
046 if nargin<2|isempty(id)
047   % Make a list of all possible main effects and interaction effects
048 %------------------------------------------------------------------
049   [y,id]= yates(ef);
050 end
051 % Secret option
052 if nargin<3|isempty(offset),offset = range(ef(2:end,:))/(3*n);end
053 [eff, ind] = sort(ef(2:end,:));
054
055 id = id(ind,:);
056 F = (0.5:n-1.5)'/(n-1);
057 nscore = wnorminv(F);  % Normal score
058 ind = (diff(eff)==0);
059 ind = find(([0;ind] | [ind; 0])==0);
060 h1 = plot(eff(ind),nscore(ind),'.');
061 h2 = text(eff(ind)+offset,nscore(ind),id(ind,:),...
062     'HorizontalAlignment','left','VerticalAlignment','middle');
063 eff(ind) = [];
064
065 if ~isempty(eff)
066   nscore(ind) = [];
067   id(ind,:) = [];
068   iy = 1;
069   ne = length(eff);
070   hold on
071   for ix=2:ne
072     iy = iy+1;
073     if ix==ne |eff(ix) ~= eff(ix+1),
074       tmp =  mean(nscore(ix-iy+1:ix));
075       h1 = [h1 ; plot(eff(ix),tmp,'k.')];
076       %h1 = text(eff(ix),tmp,num2str(iy));
077       tmp2 = cellstr(id(ix-iy+1:ix,:)).';
078       [tmp2{2,1:iy-1}] = deal(', ');
079       tmp2{2,iy} = ' ';
080       h2 = [h2;text(eff(ix)+offset/2,tmp,cat(2,[num2str(iy) ' '],tmp2{:}),...
081     'HorizontalAlignment','left','VerticalAlignment','middle')];
082
083       iy = 0;
084     end
085   end
086   hold off
087 end
088 if nargout>0,
089   h = [h1;h2];
090 end
091 xlabel('Effect')
092 ylabel('Nscore')
093
094
095
096

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group

Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003