Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Determine random coefficient for two sites

Hi,
I have two sites, only one should always been seen, so far I can split them 50/50 with SysRand(a,b) within a constructed list with other sites.
Now I would like to have a different distribution. I would like to show "site a" with 67% and "site b" with 33%

Is that easy to implement? How do I have to adjust SysRand?
asked Dec 6, 2017 by anonymous

1 Answer

0 votes
Use SysRand(1,3). Then show "Site A" if SysRand <3 and "Site B" if SysRand=3. If you have a more precise distribution to consider, I'd use the RandNum() function instead.
answered Dec 6, 2017 by Aaron Hill Silver Sawtooth Software, Inc. (8,365 points)
Can you be more specific?

I am using a parent list  with 14 members.

This is how my constructed list looks:
ADD(Parent,SysRand(1,2))
ADD(Parent,SysRand(3,4))
ADD(Parent,SysRand(5,6))
ADD(Parent,SysRand(7,8))
ADD(Parent,SysRand(9,10))
ADD(Parent,SysRand(11,12))
ADD(Parent,SysRand(13,14))
Randomize()

I defined the postions in random blocks menu.

I want now change the fifth "add" to 67% and 33%

My thought now was to somehow create another constructed list (ABC) and there make my conditions with 2/3 and 1/3 and then put in ADD(ABC) instead of ADD(Parent,SysRand(9,10)) in the constructed list above.

If there is an easier solution I would take that too :)
Sorry for bumping, but I need a solution quickly :)
I see your problem. In this case, I'd probably do it with unverified perl:

Begin Unverified Perl
ADD("Parent",SYSRAND(1,2));
ADD("Parent",SYSRAND(3,4));
ADD("Parent",SYSRAND(5,6));
ADD("Parent",SYSRAND(7,8));
ADD("Parent",SYSRAND(11,12));
ADD("Parent",SYSRAND(13,14));
my $intVar = SYSRAND(1,3);
if($intVar <= 2)
{
    ADD("Parent",9);
}
else
{
    ADD("Parent",10);
}
RANDOMIZE();
End Unverified
Perfect. Looks at first sight it does work.

How can I test if the distribution is how I want to have it?
Run the Data Generator a bunch of times and look at how often each appears on the list. When I developed the code, I did it in a stripped down survey with just this element, and tested it to make sure it worked, so if you're doing substantially the same thing I did, it should work exactly the same.
Okay. Thank you. Suppose I want now all of my six other "Adds" have the same 67/33 distribution. How do I do that?
Can I just add more times "my $intVar = SYSRAND(1,3);" ?

Begin Unverified Perl
my $intVar = SYSRAND(1,3);
if($intVar <= 2)
{
    ADD("Parent",1);
}
else
{
    ADD("Parent",2);
}
my $intVar = SYSRAND(1,3);
if($intVar <= 2)
{
    ADD("Parent",3);
}
else
{
    ADD("Parent",4);
}
my $intVar = SYSRAND(1,3);
if($intVar <= 2)
{
    ADD("Parent",5);
}
else
{
    ADD("Parent",6);
}
....
....
....
RANDOMIZE();
End Unverified


Or does this not work?
Found solution myself.

I made 7 new constructed lists and then added them all together in one more constructed list.
...