Home > wafo > wstats > sudg.m

sudg

PURPOSE ^

Some Useful Design Generators

SYNOPSIS ^

[I,R] = sudg(n,p,varargin)

DESCRIPTION ^

 SUDG Some Useful Design Generators
 
  CALL:  [I, R] = sudg(n,p);
 
  I = matrix of generating relations. size p X q
  R = Resolusion
  n = number of variables.
  p = number of generators.
 
  SUDG may be used in conjunction with FFD to construct two-level
  fractional factorial designs with the highest possible resolution.
  In general, a 2^(n-p) fractional design is produced by P generators and
  has a defining relation containing 2^P words. The resolution R of a
  fractional design is the length of the shortest word in the defining
  relation. A resolution R design has a complete factorial (possibly
  replicated) in every subset of R-1 variables. In general, a design of
  resolution R is one in which no k-factor effect is confounded with any
  other effect containing less then R-k factors.
 
  See also  ffd, cl2cnr, cnr2cl

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function [I,R] = sudg(n,p,varargin)
002 %SUDG Some Useful Design Generators
003 %
004 % CALL:  [I, R] = sudg(n,p);
005 %
006 % I = matrix of generating relations. size p X q
007 % R = Resolusion
008 % n = number of variables.
009 % p = number of generators.
010 %
011 % SUDG may be used in conjunction with FFD to construct two-level
012 % fractional factorial designs with the highest possible resolution.
013 % In general, a 2^(n-p) fractional design is produced by P generators and
014 % has a defining relation containing 2^P words. The resolution R of a
015 % fractional design is the length of the shortest word in the defining
016 % relation. A resolution R design has a complete factorial (possibly
017 % replicated) in every subset of R-1 variables. In general, a design of
018 % resolution R is one in which no k-factor effect is confounded with any
019 % other effect containing less then R-k factors.
020 %
021 % See also  ffd, cl2cnr, cnr2cl
022 
023 
024 % Reference 
025 % Box, G.E.P, Hunter, W.G. and Hunter, J.S. (1978)
026 % Statistics for experimenters, John Wiley & Sons, chapter 12,pp 410
027 
028 
029 % Tested on: Matlab 5.3
030 % History:
031 % By Per A. Brodtkorb 16.03.2001
032 
033 %error(nargchk(2,3,nargin))
034 nmp = n-p;
035 if isempty(p)|p<=0, I = zeros(0,1); R = nmp+1; return;end
036 
037 
038 if p ==1,
039   I = 1:n;
040   R = nmp+1;
041 elseif n+1==2^nmp, % Saturated Resolution III design
042   I = zeros(n,nmp);
043   iz = 0;
044   for ix = 1:nmp,
045     iz      = iz+1;
046     I(iz,1) = ix;
047     iz0     = iz;
048     for iy = 1:iz0-1,
049       iz = iz+1;
050       I(iz,:)   = I(iy,:);
051       ind        = min(find(I(iy,:)==0));
052       I(iz,ind) = ix;
053     end
054   end
055   
056   k = find(I(:,2)~=0); % Find only interactions
057   I = [I(k,:) (nmp+1:n).'];
058   R = 3;
059 else
060   % The following is taken from Box et-al(1978) pp 410
061  txt =  'Requested design is not currently available or impossible';
062   switch nmp,
063     case 3, %8,
064       if p>4, error(txt), end      
065       I0 =  [1:2 0; 1 3 0; 2:3 0; 1:3];
066       R =3;
067     case 4, %16,
068       if p>11, error(txt), end
069       I0 = [1:3 0; 2:4 0; 1 3:4 0; 1 2 4 0; 1:4; 1:2 0 0; ....
070         1 3 0 0;1 4 0 0; 2 3 0 0; 2 4 0 0; 3 4 0 0 ];
071       if p>=5, R=3;else,R=4;end
072     case 5, %32,
073       if p>6, error(txt), end
074       if p== 6;
075     I0 = [1:3;2:4;3:5;1 3:4; 1 4:5; 2 4:5];
076       elseif p==3
077     I0 =[1:3 0; 1:2 4 0; 2 3:5];
078       else
079     I0 = [ 1 2 3 5 ; 1 2 4 5; 1 3 4 5; 2 3  4 5;  1 2 3 4];
080       end
081       R = 4;
082     case 6,% 64,
083       if p>5, error(txt), end
084       if p==5,
085     I0 = [1:4; 3:5 0; 2 4 5:6; 1 4:6; 1:2 6 0];
086       elseif p==4
087     I0 = [2:4 6; 1 3:4 6; 1 2 4:5; 1 2 3 5 ];
088       else
089     I0 = [1:4; 1:2 5:6; 2 4:6  ];
090       end
091       if p>=3, R=4;else,R=5;end
092     case 7, %128,
093       if p>4, error(txt), end
094       if p==2,
095     I0 = [1 3:4 6:7; 2:3 5:7 ];
096     R = 6;
097       else
098     I0 = [1:3 7 0 0 0; 2:5 0 0 0; 1 3:4 6 0 0 0; 1:7 ];
099     R = 5;
100       end
101       
102     otherwise,
103       error(txt)
104   end
105   I = [I0(1:p,:) (nmp+1:n).'];
106 end
107 I = sort(I,2);
108 if nargin<3 & n<=50;, % secret option
109   I = cnr2cl(I); % Convert column number to column label
110 end
111 
112 
113 
114 
115

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