BookmarkSubscribeRSS Feed
Dave90
Calcite | Level 5

Hello,

 

this is the first SAS-question I ever posted and I am completely new to SAS (version 9.4). I only need to program one thing with SAS, but I encountered a problem, I cant find the answer for. I need to find an optimal Design for an intelligence test using the optex procedure. Here is the code I have so far:

 

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;
data Candidate; set Candidate;
if (^((x1 = 1) & (x2 = 1) & (x3 = 1) & (x4 = 1) & (x5 = 1)));
if (^((x6 = 1) & (x2 = 1) & (x3 = 1) & (x4 = 1) & (x5 = 1)));
if (^((x1 = 1) & (x6 = 1) & (x3 = 1) & (x4 = 1) & (x5 = 1)));
if (^((x1 = 1) & (x2 = 1) & (x6 = 1) & (x4 = 1) & (x5 = 1)));
if (^((x1 = 1) & (x2 = 1) & (x3 = 1) & (x6 = 1) & (x5 = 1)));
if (^((x1 = 1) & (x2 = 1) & (x3 = 1) & (x4 = 1) & (x6 = 1)));
if (^((x1 = 1) & (x2 = 1) & (x3 = 1) & (x4 = 1) & (x5 = 1) & (x6 = 1)));
if (^((x1 = 1) & (x2 = 0) & (x3 = 0) & (x4 = 0) & (x5 = 0) & (x6 = 0)));
if (^((x1 = 0) & (x2 = 1) & (x3 = 0) & (x4 = 0) & (x5 = 0) & (x6 = 0)));
if (^((x1 = 0) & (x2 = 0) & (x3 = 1) & (x4 = 0) & (x5 = 0) & (x6 = 0)));
if (^((x1 = 0) & (x2 = 0) & (x3 = 0) & (x4 = 1) & (x5 = 0) & (x6 = 0)));
if (^((x1 = 0) & (x2 = 0) & (x3 = 0) & (x4 = 0) & (x5 = 1) & (x6 = 0)));
if (^((x1 = 0) & (x2 = 0) & (x3 = 0) & (x4 = 0) & (x5 = 0) & (x6 = 1)));
if (^((x1 = 0) & (x2 = 0) & (x3 = 0) & (x4 = 0) & (x5 = 0) & (x6 = 0)));
run;
proc print data=Candidate(obs=16);
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;
blocks structure = (20)12;
output out=IQ;
proc print data= IQ;
run;

 

As you can see, there are six different nominal factors defined (x1-x6). Each factor represents a rule of thinking that is either required in a test item (factor value = 1) or not (factor value = 0). Each item can hence be seen as a specific experimental condition, which is defined by a certain combination of factor levels, that is a specific combination of applied rules of thinking. I excluded all conditions from the design in which zero, only one, or more than four rules are active. Here is my problem: For practical reasons, we cannot have the testees work on too many four-rule-items because they are too difficult and time consuming. The idea is, that we have 20 people work on 12 items each (I programed that using the blocks structure statement). I would like to implement the constraint that only 2 out of the 12 items for each person are 4 rule-items. The rest beeing five 2-rule items and five 3 rule-items. Then I would like to recieve the optimal design for that. Is that somehow possible? Thank you in advance.

2 REPLIES 2
IanWakeling
Barite | Level 11

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.

Dave90
Calcite | Level 5

Yes, I am aware of the problems with implementing these constraints. But I will try to get the design in two steps. Thank you for the advice.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1319 views
  • 2 likes
  • 2 in conversation