options ps=500 nodate; title ' '; PROC IML; print 'BLOCKING USING SCORES'; 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; SCORBI=SCORB; AI=XINV*A2; SCORBI[,BL1]=SCORB[,BL1]+AI; SCORBI[,BL2]=SCORB[,BL2]-AI; SSS=SCORBI#SCORBI; SSS=(SSS[,+]); CRIN=WEI*SSS[2:P1]/sum(WEI); if CRIN0); run GENERATE; end; XINVU=inv(IT); XINVU=XINVU[1:P1,1:P1]; SCOR=(XINV*X[1:N,]`); SCORB=SCOR*B; SSS=SCORB#SCORB; SSS=(SSS[,+]); CRITERI=WEI*SSS[2:P1]/sum(WEI); BET=1; do until(BET=0); /* SCORB=SCORB[2:P1,]; */ run SCORE; end; DATAC=DATAC//CRITERI; if CRITERI