0 votes
in SoSci Survey (English) by s247792 (130 points)
  • Each participant in a survey solves 4 problems.

  • For each problem from the 4, participants in a survey solve it with a randomly chosen profile (I have 5 different groups and each group has 5 profiles).

*For example,
Problem 1 with (Group 1, random Profile 1);
Problem 1 with (Group 2, random Profile 3);
Problem 1 with (Group 3; random profile 5);
Problem 1 with (Group 4; random Profile 4);
Problem 1 with (Group 5; random Profile 2)

**For each problem, I do not want a participant to solve a question with a profile twice (i.e. I want to randomise without replacement). For example, a participant cannot solve Problem 1 with (Group 1, random Profile 1) and Problem 2 with (Group 1, random Profile 1). Instead, she can solve it with (Group 1, one of random Profiles 2, 3, 4 or 5).

  • Is there a way to ensure that each participant in the survey will not answer a different problem with the same profile?

Thank you very much

by SoSci Survey (290k points)
I am not sure, if I understand the question correctly. What I read: You have 5 x 5 = 25 problems to be solved. These are localted in a matrix of 5 "groups" and 5 "profiles". And now you want to draw 4 from the 25 problems that are from different profiles. Is that correct?
by s247792 (130 points)
Hi and thank you so much for your reply!

To clarify, I have 4 types of questions (e.g. Qa, Qb, Qc, Qd).

Each question is answered based on displaying information of a random profile drawn from each of 5 different groups, without replacement.

So, I have 5 groups. Each group is of size 5, so Group 1 has 5 people; Group 2 has 5 other different people, Group 3 has 5 other different people,..., etc.

For example, for Qa:

answer Qa with (Group 1, random Profile 1);
answer Qa with (Group 2, random Profile 3);
answer Qa with (Group 3; random profile 5);
answer Qa with (Group 4; random Profile 4);
answer Qa with (Group 5; random Profile 2)

For "Qb Group 1", I do not want the person taking the survey to have a profile that they have already seen before in "Qa Group 1" (hence without replacement).

Another example: for "Qc Group 2", I do not want the person taking the survey to have a profile that they have seen before in "Qa Group 2" and "Qb Group 2".

Hope this is more clear?

1 Answer

0 votes
by SoSci Survey (290k points)

Thanks for the clarification. I now understand that you need all 5 profiles for Question Qa. And then again in Question Qb, but you need to ensure that the profile is always a different one.

So, what you actually need is different rotations of the profile order (there are 5! = 120 possible rotations), but the number of possible orders is limited in each iteration, i.e., you have only 4! = 24 possible rotations for Qb (given the Qa order) and only 3! = 6 for Qc.

The only option I see here, is to solve this programatically. That is: Do the first rotation (Qa), then define what profiles are left for each group for Qb, and so on. The challenge is that you have two restrictions at once/at cross (unique per profile, and unique per question), and while I am sure that there is an efficient algorithm for that, I do not know that one currently.

What I can offer is solution that will use 120 of the possible 120 24 6 * 2 = 34.560 possible combinations.

// Define the profiles
$profiles = [1,2,3,4,5];
// Build a matrix with a valid solution
$matrix = [];
for ($x=0; $x<5; $x++) {
    $matrix[$x] = [];
    for ($y=0; $y<5; $y++) {
        $matrix[$x][$y] = ($x + $y) % 5;

// Now shuffle rows
$order = [0,1,2,3,4];

// Resort matrix (1)
$matrix2 = [];
for ($x=0; $x<5; $x++) {
    $matrix2[$x] = [];
foreach ($order as $old => $nw) {
    for ($x=0; $x<5; $x++) {
        $matrix2[$x][$old] = $matrix[$x][$nw];
$matrix = $matrix2;

// Now shuffle columns
$order = [0,1,2,3,4];

// Resort matrix (2)
$matrix2 = [];
foreach ($order as $old => $nw) {
    $matrix2[$nw] = $matrix[$old];
$matrix = array_values($matrix2);


Store that matrix in internal variables, and use them to select the profiles in question Qa (that would be $matrix[0]), Qb (that would be $matrix[1]), etc.

If you're not sure about the brackets, read the manuals on Arrays, please.

Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen

Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question