```Date: Wed, 17 Sep 2008 10:22:03 +0100 Reply-To: Ian Wakeling Sender: "SAS(r) Discussion" From: Ian Wakeling Subject: Re: PLAN: cyclic (to generate and randomize a BIBD) In-Reply-To: Content-Type: text/plain; charset="us-ascii" Your 3 point randomization procedure looks good to me. I don't have a copy of Fisher and Yates, but I think that any construction of the v=16, k=6 symmetric BIBD is going to be beyond the capability of PROC PLAN as each symbol of the design will be represented by more than one element. In the construction below, there are 4 elements to each symbol and they are developed cyclically mod(2,2,2,2), or in other words adding the binary representation of the numbers 0 to 15 to the starter block held in the temporary array. data bibd; array z (6,4) _temporary_ ( 1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1, 1,1,0,0, 0,0,1,1); array i (4) _temporary_; do b=1 to 16; i(1)=band(b-1,1); i(2)=band(b-1,2)/2; i(3)=band(b-1,4)/4; i(4)=band(b-1,8)/8; put i(4) i(3) i(2) i(1); do k=1 to 6; v=1; do j=1 to 4; v + (2**(j-1)) * mod(z(k,j)+i(j),2); end; output; end; end; drop j; run; /* check sample concurrence within blocks */ proc sql noprint; create table concurr as select a.v as v1, b.v as v2 from bibd as a, bibd as b where (a.b=b.b) and (b.v>a.v); quit; proc tabulate data=concurr noseps; class v1 v2; tables v1, v2*n=' '*f=2.0 /rts=6; run; -----Original Message----- From: ./ ADD NAME=Data _null_, [mailto:iebupdte@gmail.com] Sent: 16 September 2008 23:45 To: Ian Wakeling; SAS-L@listserv.uga.edu Subject: PLAN: cyclic (to generate and randomize a BIBD) I'm fiddling with PLAN to randomize plan 29 from Fisher and Yates Table XVII. This is a Cyclic solution in two families. This is code I came up but I ask other PLAN/BIB experts if this is reasonable. Also, I am trying to generate plan 5 from the same table. It is Dicyclic solution a(1) a(2) a(3) b(1) c(4) d(1). r k 6 v b 16 lambda 2 I ain't gettin' it. dm 'clear log; clear output;'; options ls=64 ps=51; title1 'BIBD, Plan 29 from Fisher and Yates, Table XVII.'; footnote1 'r(replications)=10, k(units per block)=5, v(treatments)=41,'; footnote2 ' b(blocks)=82, lambda(r(k-1)/(v-1))=10(5-1)/(41-1)=1'; /* Plan 29 from Fisher and Yates, Table XVII. r(replications)=10, k(units per block)=5, v(treatments)=41, b(blocks)=82, lambda(r(k-1)/(v-1))=10(5-1)/(41-1)=1 Randomization 1) Rearrange the blocks at random. 2) Randomize the position of the treatment numbers within each block. 3) Assign treaments at random to the numbers in the plan. ------------------------------------------------*/ **Convert "initial block" letters to numbers for PROC PLAN**; data _null_; infile cards missover; length alpha \$52 ib \$256.;; retain alpha; if _n_ eq 1 then do; alpha = collate(97,122)||collate(65,90); put alpha=; end; input s :\$1. @; do while(not missing(s)); n = index(alpha,s); put n= s=; ib = catx(' ',ib,n); input s: \$1. @; end; call symputx(cats('ib',_n_),ib); cards; a j p r K a s E F I ;;;; run; **Generate two data sets for the Cyclic solution in two famlies**; proc plan ordered; factors b=41 ordered k=5 ordered / noprint; treatments v=5 of 41 cyclic(&ib1); output out=family1; run; factors b=41 ordered k=5 ordered / noprint; treatments v=5 of 41 cyclic(&ib2); output out=family2 b nvals=(42 to 82 by 1); run; quit; **Combine the families into one plan and save unrandomized version of the variable B V K.**; data planV / view=planV; set family1 family2; b0 = b; **Save the unrandomized version of the plan; v0 = v; k0 = k; y = rannor(1234556); run; **Randomize the plan**; proc plan seed=594276736; factors b=82 k=5 / noprint; output data=planV out=plan2; run; factors v=41 / noprint; output data=plan2 out=plan; run; quit; proc report data=plan nowd list panels=2; columns b k,v dummy; define b / group format=f5. 'Block' '--'; define k / across format=f2. 'Plot' '--'; define v / display format=f2. '--'; define dummy / noprint; run; On 9/14/08, Ian Wakeling wrote: > Jerry, > > When it comes to balanced incomplete block designs don't abandon all those > tables from the 1950s. > > For example I would think you will have problems adapting your OPTEX code > below to find an equivalent to this cyclic balanced design: > > proc plan; > factors block=19 ordered r=9 ordered; > treatments v=9 of 19 cyclic(1 4 5 6 7 9 11 16 17); > output out=c1; > run; > > Ian. > > -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Jerry > Davis > Sent: 12 September 2008 18:55 > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: PLAN: cyclic > > "./ ADD NAME=Data _null_," wrote: > > > Do you think you could find a bit of time to show an example of > > generating a similar plan using PROC OPTEX. > > The design is: two factors, b has 13 levels and r has 3. There are 13 > blocks of size 3. Here is data null's original PROC PLAN followed by my > PROC OPTEX. But first a couple notes on OPTEX > > 1) I used a seed for OPTEX. If you omit it you will get a different > design with every run. The efficiencies remain the same, however. > 2) "blocks" is colored red in my editor, but it is not an error. > 3) Syntax for the blocks statement is: > blocks structure=(number of blocks)block size > 4) OPTEX is in SAS/QC if you don't have it, I've included the design > points from a run below the program. > > > proc plan; > factors b=13 ordered r=3 ordered; > treatments v=3 of 13 cyclic(1 3 9); > output out=c1; > run; > proc print; > run; > > data one; *generate all treatment combinations for optex; > do b=1 to 13 by 1; > do r=1 to 3 by 1; > output; > end; > end; > run; > > proc optex data=one coding=orth seed=475836; > class b r; > model b r; > blocks structure=(13)3 niter=50 keep=10; > output out=new; > run; > > proc print data=new; > run; > > proc freq data=new; > tables b*r / list; *check for dups in the design; > tables block*b*r / list; *check for dups within block; > run; > > Design points: > > Obs BLOCK b r > 1 1 1 2 > 2 1 3 1 > 3 1 5 3 > 4 2 12 2 > 5 2 7 3 > 6 2 9 1 > 7 3 4 1 > 8 3 2 3 > 9 3 11 2 > 10 4 10 3 > 11 4 9 2 > 12 4 8 1 > 13 5 11 1 > 14 5 1 3 > 15 5 7 2 > 16 6 5 2 > 17 6 12 1 > 18 6 6 3 > 19 7 4 3 > 20 7 6 2 > 21 7 13 1 > 22 8 10 1 > 23 8 2 2 > 24 8 3 3 > 25 9 4 2 > 26 9 9 3 > 27 9 5 1 > 28 10 8 2 > 29 10 12 3 > 30 10 2 1 > 31 11 6 1 > 32 11 10 2 > 33 11 11 3 > 34 12 3 2 > 35 12 7 1 > 36 12 13 3 > 37 13 8 3 > 38 13 1 1 > 39 13 13 2 > > Jerry > -- > Jerry Davis > Experimental Statistics > UGA, CAES, Griffin Campus > ```

Back to: Top of message | Previous page | Main SAS-L page