Have an idea?

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

SysRand + Quota Control

I am new to Sawtooth and stumbled upon two questions:
1.) How random is "SysRand"? A colleague of mine used SysRand (using the Skip logic "SysRand(1,3)=1") for his survey. He had three groups. After a week GroupA contained 133 surveys, GroupB had 33 and GroupC 38. Not so random?
2.) To avoid this I was thinking of combining SysRand and Quota Control. How I am doing this? For SysRand I used a free-format question with a hidden variable, it looks like that:
<input name="Random_CODE" type="hidden" value="
Begin Unverified Perl
 my $NumRand_code=0;
 return $NumRand_code;
End Unverified

Is this code the same to the one of my colleague besides I am getting an extra variable into my database?

How do I setup now that all three SysRand Groups have a maximum of 50 surveys? I dont really want to disqualify people. Suppose GroupA has already 50 and is full, I want that the next one is randomly assigned to GroupB or GroupC, so I am not "wasting" survey takers.

Thank you in advance!
asked Jul 18, 2017 by anonymous
I ran a quick test calling SysRand one million times.  The function returned one 333,318 times, returned two 333,295 times, and returned three 333,387 times.  Perhaps there was another factor that caused the uneven distribution.

My understanding is that the first skip should skip to Group A if SysRand(1,3)=1, the second skip should skip to Group B if SysRand(1,2)=1, and the third skip should skip to Group C always - is that what was done?
What other factors can cause the uneven distribution? I read it depends on the system clock somehow?!

He did it without defining a new variable and setup three Skip Logics:
SysRand(1,3)=1 -> Skip to Group A
SysRand(1,3)=2 -> Skip to Group B
SysRand(1,3)=3 -> Skip to Group C

And the result was that uneven distribution.
Maybe it is better to define groups within and return more numbers?
SysRand(1,300)=1-100 -> Group A
SysRand(1,300)=101-200 -> Group B
SysRand(1,300)=201-300 -> Group C

Could this be better?
The key here is that every SysRand call is independent.  Each of those skip logics is potentially getting a different random number.  So with your colleague's skip logic, it is actually possible that none of the skips will activate.

Your free format variable is one way to get around this, because now SysRand is only being ran once per respondent rather than once per skip.

Another alternative is to use the skip logics I posted above.  Because skip logics are tested in order, my code should produce three fairly evenly distributed groups.

1 Answer

0 votes
Setup your quota question with the 3 groups and select "Always Qualify" for each group. Set their targets to 50.

Click on the "Advanced" tab and under "Check for Cell Membership", select "Randomize all".

This will randomly select a group for each respondent. Once a group has reached their target of 50, only the other 2 remaining groups will be selected. And then when 2 groups have reached their target, the sole remaining group will be the only selected group.

Give it a test drive. Good luck.
answered Jul 18, 2017 by Paul Moon Platinum (70,315 points)
Thanks for a quick answer.

So with (randomize all) quota control I dont need SysRand? Is that correct?

How can I run a test on my local computer without using a server, seeing of my quotas are filled?
No need for the hidden variable: SysRand.

You can use the data generator or test your survey locally via the Test menu option.