I was in a hurry to go somewhere this morning and did not quite get the restrictions right in my previous post. I edited them. Below, I modified the restrictions so it is bad if either alternative has more yesses and a lower price.
%macro res;
bad = (all(x[1,1:3] = 1) & all(x[2,1:3] = 2)) +
(all(x[1,1:3] = 2) & all(x[2,1:3] = 1));
g1 = (x[1,1:3] = 2)[+]; * Yesses in alt 1;
g2 = (x[2,1:3] = 2)[+]; * Yesses in alt 2;
bad = bad + (g1 > g2 & x[1,4] < x[2,4]); * More yesses in 1 and lower price in 1;
bad = bad + (g2 > g1 & x[2,4] < x[1,4]); * More yesses in 2 and lower price in 2;
%mend;
%choiceff(data=design, /* candidate set of alternatives */
restrictions=res, resvars=x1-x4,
model=class(x1-x4/sta), /* model with stdz orthogonal coding */
nsets=8, /* number of choice sets */
flags=2, /* 2 alternatives, generic candidates */
maxiter=60, /* maximum number of designs to make */
seed=12655, /* random number seed */
options=relative, /* display relative D-efficiency */
beta=zero); /* assumed beta vector, Ho: b=0 */
Restrictions are written in IML syntax. If you are going to be doing this often, you should study that syntax.
Examples:
vector = constant ---> results in a vector of zeros (when an element does not equal the constant) and ones (equal)
vector[+] ---> sum of the elements in a vector. In the example, vector results from an expression.
Also note the result of any Boolean (logical) expression is zero (false) or one (true) and hence can be used in an arithmetic expression.
... View more