I am not sure that I can offer a solution here, only some suggestions on how to check up on what OPTEX is doing. I have modified your code as follows:
proc plan ordered;
factors x1=2 x2=2 x3=2 x4=2 x5=2 x6=2 / noprint;
output out=Candidate
x1 nvals=(0 to 1)
x2 nvals=(0 to 1)
x3 nvals=(0 to 1)
x4 nvals=(0 to 1)
x5 nvals=(0 to 1)
x6 nvals=(0 to 1); *give each level a valuename. Since it is nominal I choose the classic 0 and 1;
run;
data Candidate;
set Candidate;
nitems = sum (of x1-x6);
if nitems in (2,3,4); /* this is equivalent to the 15 if statements above */
rnum + 1; /* number each candidate run */
rstr = cats( of x1-x6 ); /* make a string that represents each run */
run;
proc freq data=candidate;
tables nitems;
run;
proc optex data=Candidate seed=123456 coding = orth;
class x1 x2 x3 x4 x5 x6;
model x1 x2 x3 x4 x5 x6 x1*x2 x1*x3 x1*x4 x1*x5 x1*x6 x2*x3 x2*x4 x2*x5 x2*x6 x3*x4 x3*x5 x3*x6 x4*x5 x4*x6 x5*x6;
id rnum rstr nitems;
blocks structure = (20)12;
output out=IQ;
run;
proc tabulate data=IQ noseps;
class rnum rstr nitems;
tables rnum*rstr*nitems, n*f=3.0;
run;
proc tabulate data=IQ noseps;
class block x1-x6 nitems;
tables block, (x1-x6)*n=' '*f=3.0;
tables block, nitems*n=' '*f=3.0;
run;
From the output of the 1st TABULATE it is clear that, in order to support the model you have specified, OPTEX gives preference to candidates with 2 and 4 items as they are selected 6 times each, while candidates with 3 items are only selected 3 times each. So the further restrictions that you want to place on the 4 item candidates must reduce the quality of the design that you get. The last table shows that each subject currently gets 4 or 5 runs with 4 items, and you want to reduce this to 2.
I would consider making the design in two steps. So first select 240 runs using the model you want, and then divide them into blocks in a 2nd step. You could do this with two OPTEX statements or by adding a GENERATE n=240 statement to your existing code. You could then use the AUGMENT option to force a preselected set of 40 4 item candidates into the design. Then augment these from a candidate set that has all the 2 and 3 items runs.
You are putting a lot of constraints on the problem and I would recommend proceeding with caution. Perhaps pilot your experiment with 6 or 7 subjects and check that you are able to analyze the data how you intended.
... View more