0 votes
in SoSci Survey (English) by s164908 (110 points)

Hello,

I'm trying to make a lengthy survey with multiple instruments used.

I want to shuffle different instruments in order to avoid biasing the data.

I want to do the following:

  • Shuffle a group of instruments between the first page and the second to last page (one instrument should always come first; a page with demographic question and another page with external link should always be in the end)
    I also want to
  • Shuffle pages within certain instruments; some instruments take up multiple pages - a block (intro page with explanation + multiple stimuli in an instrument); I always want to display explanation first, then shuffle the stimuli/pages within this block

How can I ensure this nesting of shuffleing?

I created following set of codes, one for high-level shuffle, and one for in-block shuffle.

But the issue is - some pages are displayed twice, while other pages are not displayed at all. I don't know why.

BLOCK SHUFFLE
$pages = [

['MFQ11', 'MFQ12'],
['MFQ2'],
['OPVINJ', '*RandomVinj*', 'A1', 'A2', 'A3', 'B1', 'B2', 'B3', 'C1', 'C2', 'C3', 'D1', 'D2', 'D3', 'E1', 'E2', 'E3', 'K1', 'K2', 'K3'],
['sgi', '*randomsilg*', 's1', 's2', 's3', 's4', 's5', 's6', 's7', 's8', 's9', 's10', 's11', 's12', 's13', 's14', 's15', 's16'],
['CRT', '*randomCRT*', 'c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'c9', 'c10', 'c11', 'c12', 'c13', 'c14', 'c15', 'c16', 'c17'],
['imhs', 'MHS'],
['CTSQ']

];

// Shuffle the parent array
shuffle($pages);

// Use as page order
setPageOrder($pages, 'demo');

Then I have another code to shuffle some pages within a block. Here's an example:
question('RG01');
$pages = valueList('RG01', NULL, 'label');
setPageOrder($pages, 'sgi');

Can someone help me determine why it's bugging and how to fix it?

Thx!

1 Answer

0 votes
by SoSci Survey (305k points)

How can I ensure this nesting of shuffleing?

Start with the second one, and then use a random generator with two codes to decide where to add the the "first group".

But the issue is - some pages are displayed twice, while other pages are not displayed at all.

Are you using another setPageOrder() or setNextPage() or loopPage() anywhere on the pages? This will break the page order previously set.

by s164908 (110 points)
I'm not sure what do you mean by start with the second one and use random generator?
by SoSci Survey (305k points)
With "the second one" I meant "Shuffle pages within certain instruments". Although, I must admit, I read your question wrong.

Okay, the trick is: You build the page order step by step. So, if you have an explanation page, and then pages to rotate, that create an array with the pages to rotate, shuffle them, and then merge and array with the explanation page (single element in that array) with the shuffled array. And then merge with the next explanation page, and the pages that belong to that one.

Have a look at array_merge() and the codes in the manual and the online support that use that function. I think, it will become more obvious, then.

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

...