options ps=500 nodate; title ' '; PROC IML; print 'BLOCKING USING DS'; start DESIGN; TRIES=100; /* Enter Number of Tries */ BLOCK=4; /* Enter Total Number of Blocks */ NB=3; /* Enter Number of High Score Blocks (a) */ BSIZE={9 9 9 9};/* Enter Vector of Block Sizes */ /* Enter Presence (1)/ Absence (0) */ /* of Terms in the Model - Based on */ /* the Full Second-order Model */ /* The Intercept is included automatically*/ MODEL={1 1 1 1 1 1 1 1 1 1 1 1 1 1 }; /* Enter Weights for each Linear, */ /* for each Quadratic, */ /* for each Interaction. */ WEI={ 1 1 1 1 1 1 1 1 1 1 1 1 1 1}; print TRIES BLOCK NB ; print WEI; /* Enter the Treatment Set */ /* XX is the treatment set Matrix */ XX={ -1 -1 -1 0, -1 -1 1 0, -1 1 -1 0, -1 1 1 0, 1 -1 -1 0, 1 -1 1 0, 1 1 -1 0, 1 1 1 0, -1 -1 0 -1, -1 -1 0 1, -1 1 0 -1, -1 1 0 1, 1 -1 0 -1, 1 -1 0 1, 1 1 0 -1, 1 1 0 1, -1 0 -1 -1, -1 0 -1 1, -1 0 1 -1, -1 0 1 1, 1 0 -1 -1, 1 0 -1 1, 1 0 1 -1, 1 0 1 1, 0 -1 -1 -1, 0 -1 -1 1, 0 -1 1 -1, 0 -1 1 1, 0 1 -1 -1, 0 1 -1 1, 0 1 1 -1, 0 1 1 1, 0 0 0 0, 0 0 0 0, 0 0 0 0, 0 0 0 0 }; /* B is the design matrix for blocks */ B=j(BSIZE[1],1,1); do I=2 to BLOCK; B=B//j(BSIZE[I],1,I); end; B=design(B); finish; start SWAP; BET2=0; do J=1 to NB; BL1=BLOC[J]; BS1=BSIZE[BL1]; AB=0; do I=1 to NB; if AB>0 | I>J then do; BL2=BLOC[I]; BS2=BSIZE[BL2]; do K1=KI[BL1,1] to KI[BL1,2]; do K2=KI[BL2,1] to KI[BL2,2]; if any(X[K1,2:KFAC1]=X[K2,2:KFAC1]) then do; XP=X#B1[,BL2]; XQ=X#B1[,BL1]; A2=(X[K2,]-X[K1,])`; A1=(XP[+,]/BS2-XQ[+,]/BS1)`-A2; BKVU=(A2||(A1+((BS1-1)/BS1+(BS2-1)/BS2)#A2))`*XINVU; IT=I(2)+BKVU*(A1||A2); if det(IT)^=0 then do; VNC=XINVU-XINVU*(A1||A2)*inv(IT)*BKVU; CRIN=det(VNC[2:P1,2:P1]); if CRIN0); run GENERATE; end; XINVU=inv(IT); XINVU=XINVU[1:P1,1:P1]; CRITERI=det(XINVU[2:P1,2:P1]); SCOR=(XINV*X[1:N,]`); SCORB0=SCOR*B; BET=1; do until(BET=0); SCORB=SCORB0[2:P1,]; run SCORE; end; DATAC=DATAC//CRITERI; if CRITERI