0 votes
in SoSci Survey (English) by s219203 (310 points)

I am getting lost with all the randomization options and would appreciate anyone's help to simplify what I want to do.

I would like to present 90 images to participants using the selection sequence (one image per page with an associated question; same question for all images), divided in 4 blocks (25 images, 25, 20, 20). A single question is asked in-between the blocks. I need for the images to be randomly presented to participants (which are not divided in groups according to demographics or else; I want a true randomization), and for participants to see all of the 90 images.

Hence, I would need an option allowing for randomization/rotation of the images within a questionnaire for a participants, but also need the blocks to be linked to one another as I don't want the participant to see the same image twice.

Many thanks!

by SoSci Survey (304k points)
What effect do the blocks have? Do you want to keep the images from a block together? Or do you just want to shuffle all 90 images? You comment about "I want a true randomization" makes me suspicious in that aspect :)
by s219203 (310 points)
Thank you for your follow-up questions!

Ultimately, yes I want to shuffle all 90 images per participant. Since this is a lot for them to see at once, I need some little breaks so that participants maintain their attention. As such, in-between blocks, I ask bogus question (e.g., I was born on planet Earth: true or false), and then the images resume.

I previously had my survey on Qualtrics and I achieved this within their "survey flow" function. I used a "randomizer" to select 25 images to show amongst the 90 in the first block, then add a "display branching function" to each image in the second block. That way, the randomizer in the second block only picked images that weren't previously shown to the participant in block 1. Blocks 3 and 4 had the same display branching function so that in the end, the participant had seen the 90 images but in a random order ACROSS the 4 blocks.

1 Answer

0 votes
by SoSci Survey (304k points)

I want to shuffle all 90 images per participant. Since this is a lot for them to see at once, I need some little breaks so that participants maintain their attention.

Okay, so the blocks are just for presentation. That means you can shuffle all images, and then you want to present them in blocks.

Honestly, you should consider to show only 30 images per person to keep data quality up. But I am sure, you already did and have good reasons.

So, in SoSci Survey one option would be to create a random generator with all 90 images (for example their filenames) in it. And then you tell it to draw 90 codes per interview (or less, if you have mercy with your respondents).

So, if your random generator has the name RG01, this would be a simple code to display the forst 25 images drawn.

$images = array_values(valueList('RG01', null, 'label'));
$block = array_slice($images, 0, 25);
$image = loopPage($block);
html('<div><img src="'.$image.'"></div>');

Get started with that and then let's narrow down what you need.

by s219203 (310 points)
Indeed, I have no mercy for my future participants! Haha! Unfortunately, the study is part of a bigger project and I need to keep the same design as was previously done.

For the random generator to draw the 90 images:
1) Since my images are part of subquestions within a selection sequence question, should I put the filenames or subquestions' ID as codes in the ballot?
2) Where should I put this random generator?

For the PHP code to draw images/subquestions per block:
1) Would the code you suggest be complete as is or should I modify the name of an element in it?
2) Where should I put this PHP code? As an element in the questionnaire only (aka NOT as a question within the block or as a separate section in the "list of questions")?

Many thanks!
by SoSci Survey (304k points)
> should I put the filenames or subquestions' ID as codes in the ballot?

In that case, please simply use the IDs, i.e., 1, 2, 3, ... 90

> Where should I put this random generator?

Somewhere before the first block or on the page with the first block.

> Would the code you suggest be complete

No, not if you're using a selection sequence. In that case the code would be a bit different:

$items = array_values(valueList('RG01'));
$block = array_slice($items, 0, 25);
question('SQ01', $block);

> Where should I put this PHP code?

Wherever you want to display your first block's question. Instead the selection sequence question.
by s219203 (310 points)
Ok! Looks like we've got one block working! One little thing is that the selection sequence question text lingers after the 25th image is shown. Anyway we can have it more smoothly transition to the next page?

Now, how do I create the other blocks so that the random generator remembers which image was already shown?

Here's my questionnaire's structure so far:
Page 1 = intro
Page 2 = random generator (RG01)
Page 3 = PHP code (I changed SQ01 for IT03)
Page 4 = break question 1
Page 5 = PHP code
Page 6 = end
*IT03 being only in the list of questions, not in the questionnaire.

Page 5 shows a notice: "One or more variables (IT03_02, IT03_02a, IT03_88, IT03_88a, ...) have already been asked on page 3...." and then promptly moves to page 6.
by SoSci Survey (304k points)
> One little thing is that the selection sequence question text lingers after the 25th image is shown.

Is that the last one?

> Anyway we can have it more smoothly transition to the next page?

Do display some text after the last subquestion?

> Page 5 shows a notice: "One or more variables (IT03_02, IT03_02a, IT03_88, IT03_88a, ...) have already been asked on page 3...." and then promptly moves to page 6.

You are sure that you used a different slice of the array for both parts? That is for the second part:

$block = array_slice($images, 25);  // no 0 as second parameter
by s219203 (310 points)
Yes, the glitch happens after the last image of the block, so the 25th for the first block. Text is shown during the glitch. It is the selection sequence question's title. I could move it to the sub-question's title instead, if you think it might help? It was just easier as the question's title, since it's the same text for all trials. What follows the first block of 25 images is a multiple choice question ("break question").

I did not use a different code at first. I tried your advice and change the code (PHP on page 5) to:
$items = array_values(valueList('RG01'));
$block = array_slice($items, 25);
question('IT03', $block);

There is no more notice, but all of the 90 images appear randomly (instead of another set of 25 images for that second block).
by SoSci Survey (304k points)
>  the glitch happens after the last image of the block

Do I uderstand the glitch correctly?

* The last subquestion (in this block) is answered
* The title remains visible, but it takes a second before the next page appears

> There is no more notice, but all of the 90 images appear randomly

The code array_slice($items, 25) means: Anything as of index 25 (=image 26). If you want to show another 25, please use array_slice($items, 25, 25), see https://www.php.net/manual/en/function.array-slice.php

The next one then is array_slice($items, 50, 25), apparently ;)
by s219203 (310 points)
edited by s219203
>> Do I understand the glitch correctly?

Yes. The title remains visible for a second, and the options appear as "please wait" or something like that. I would like for the text of the break question to appear right after the last subquestion is answered, not a second after the title.

>> use array_slice($items, 25, 25)

It works!
I changed the 3rd and 4th PHP codes so that the blocks show 20 images. That way, all 90 images appear at some point throughout the questionnaire (25+25+20+20=90).  

Page 1 = intro
Page 2 = random generator (RG01)
Page 3 = PHP code $block = array_slice($items, 0, 25);
Page 4 = break question 1
Page 5 = PHP code $block = array_slice($items, 25, 25);
Page 6 = break question 2
Page 7 = PHP code $block = array_slice($items, 50, 20);
Page 8 = break question 3
Page 9 = PHP code $block = array_slice($items, 70, 20);
Page 10 = break question 4
Page 11 = end

Now, any way the break questions could also be randomized per interview (i.e., showing 1 out of 4 for pages 4, 6, 8, and 10)? I would guess it needs a random generator + a PHP code. What would be the code? It's not a selection sequence and the questions (BO01...BO04 of the section BO) aren't split as "subquestions of IT03" (like the images in pages 3, 5, 7, and 9 were...)...

One more thing: Any way the progress bar could reflect the actual progress of the participant? For now, it is stuck at 25% for all of block 1, then suddenly moves and stays flat again during block 2, etc. I previously figured out a code (XX) in Qualtrics to show a text element ("Image XX of 90") that would count the number of presented elements (i.e., IT03_01..._99) so far. Would SoSci be able to do such a thing?
by SoSci Survey (304k points)
>  I would like for the text of the break question to appear right after the last subquestion is answered, not a second after the title.

Well, the questionnaire must send the results back to the server, and wait for its answer. This is why the "please wait" appears. If you want to avoid this loading time, then you would have to work with JavaScript, having both questions on the same page, and taking care that one question is hidden when the other is displayed. What we can optimize is hiding the title/explanation when the "please wait" appears. Would that help?

> Any way the progress bar could reflect the actual progress of the participant?

If you like to work with JavaScript, you can use the SoSciTools.progress instance (see https://www.soscisurvey.de/help/doku.php/de:create:soscitools) and move the bar during the task. But it's not yet implemented by default for this question.
by s219203 (310 points)
>> What we can optimize is hiding the title/explanation when the "please wait" appears. Would that help?

Yes! I'm guessing I can achieve that by leaving the "question" title empty and moving the text to the "subquestion" title instead? Any easier way (as I'll have to manually copy-paste the question into each subquestion)?



>> Progress bar

If JavaScript could work, I'll try it! I'm fairly new using it however. Reading through the link you sent, I could figure out this bit:

<script type="text/javascript">
<!--

SoSciTools.progress();

setWithinPage();

// -->
</script>

I'm not sure what to add more to the code, or where to put it. Any help appreciated!

Alternatively, as I previously mentioned, (when my survey was with Qualtrics) I had internal variables acting as a simple counter. The "counter" was equal to a value of 0 at first (in the questionnaire structure), then other internal variables (i.e., $e{ e://Field/Counter + 1 }) were paired with each subquestions/images. In text (on the same page as the image), I then displayed "Image ${e://Field/Counter} of 90", and the code was changed to the number of images shown so far in the questionnaire. Would SoSci be able to handle a similar code?



>> Any advice for randomizing the break questions as well? I've copy-paste my question again for context.

"Now, any way the break questions could also be randomized per interview (i.e., showing 1 out of 4 for pages 4, 6, 8, and 10)? I would guess it needs a random generator + a PHP code. What would be the codes? It's not a selection sequence and the questions (BO01...BO04 of the section BO) aren't split as "subquestions of IT03" (like the images in pages 3, 5, 7, and 9 were...)..."

I created another random generator, with numbers from 1 to 4 (i.e., RG02). Then, I placed a PHP code (see below) on the questionnaire page with RG02. I keep having the error message "Variable RG02 is unknown to this project (see listing of variables). Therefore no result can be retrieved." Any advice?

$number = value('RG02');
 
if ($number == 1) {
  question('BO01');
} elseif ($number == 2) {
  question('BO01');
} elseif ($number == 3) {
  question('BO02');
} elseif ($number == 4) {
  question('BO02');
}
by SoSci Survey (304k points)
Alright - we installed an update on www.soscisurvey.de that makes the selection sequence to hide the "question" when the "please wait" message is displayed. Also does the progress bar now move with the sub-questions.

> Variable RG02 is unknown to this project (see listing of variables)

(if this question is still relevant)

Could it be that you told the random generator to draw more than one code per interview? Please check the "variables" tab in the random generator for more information on the variables.
by s219203 (310 points)
I've been away some time but am back working on my survey and I still have the same issues.

1. The "please wait" still shows. Is the update something I have to activate or is it applying automatically to all selection sequence questions now?

2. The progress bar still doesn't move when I show a block of images. I still haven't figured how and where to use the SoSciTools.progress.

3. As a clarification, I would like a participant to ultimately see the 4 "bogus items" during their survey, just to have them randomly selected between each block of images. Right now, I have the random generator on the page I first want to display a bogus question, followed by this PHP code:
      $questions = valueList('RG02', NULL, 'label');
      $identifier = loopPage($questions);
      question($identifier);
The subsequent pages have only the PHP code.
The first page do display a new, random bogus item each time, but it then skips the image blocks to only she the randomized bogus items and then end the survey.

As a reminder, the structure of my survey is as followed:
Page 1 = intro
Page 2 = bogus item 1
Page 3 = image block 1
Page 4 = bogus item 2
Page 5 = image block 2
Page 6 = bogus item 3
Page 7 = image block 3
Page 8 = bogus item 4
Page 9 = image block 4
Page 10 = end

Many thanks!!
by SoSci Survey (304k points)
> 1. The "please wait" still shows.

It should ... when the last subquestion was ansered and the browser loads the next page. The update hides the question text in that moment.

If you do not want the text to show up at all, just tell SoSci Survey that the text shall be &nbsp; (that's a non-breaking space).

> 2. The progress bar still doesn't move

Try to clear the browser cache, could be a caching issue. If not, please post a pretest link directly (!) to the page with the question, please.

> 3. As a clarification, I would like a participant to ultimately see the 4 "bogus items"

Okay, now the whole questions begins making sense :) Do I understand correctly, that you want to mix the blocks and bogus items and there shall not be a "visible" transition in between?
by s219203 (310 points)
edited by s219203
1. It's actually okay for this to show. Sorry about this. We can consider this issue solved.

2. Clearing the browser cache did help.

However, the % jumps a bit weird in-between pages of the questionnaire (e.g., between a bogus item and a block of pictures). This might be due to the use of blocks and selection sequence type of question, I guess. If we can't fix this, it is not an issue. I will run the questionnaire as is.

Another thing is that the bar only moves from 1% after each 5 pictures. I would like for it to move by whatever percentage it represents in the questionnaire after each picture shown. Is there a way we could do this? Again, we could also add a code to count the number of pictures presented so far and show some text for each image such as "Picture #X of 90".

If nothing can be done, I would be okay running the survey with the progress bar working as is.

3. I think you get the gist. The transition is not really the problem here but more so that either the bogus items or the picture blocks don't show with 2 random generators in the survey.

The main point is really about randomization. My pictures and the bogus items both need to be completely randomized. The pictures are working fine right now, but I can't seem to figure out how to randomize my bogus items. I would want for them not to be in the same order for each participant. So it could be items 1, 2, 3, 4 for the first participant, then 3, 4, 2, 1 for the next, then 2, 4, 3, 1, etc. I realize that the same combination (e.g., 1, 2, 3, 4) will come back for other participants, but that's okay. I just want it to be randomized every time an interview is started.

Thank you again!
by SoSci Survey (304k points)
SoSci Survey calculates the percentages based in page numbers. So if you have a very long page (or one that shows several sub-questions) and a very short page (only the bogus items), each will get the same share of the percentages.

You can use the option() function to adjust the percentage that is shown on a specific page. This, however, will not influence how far the bar moves on the page with the selection sequence.

In my opinion, the "clean" solution would be to get all items/subquestions into one question, and take care about proper rotation of the subquestions.

The other option would be to work a bit with JavaScript to tell the progress bar how far to proceed on the page. You can try this one als HTML code on the page:

<script type="text/javascript">
SoSciTools.progress.present(30, 20, 40);
</script>

This will tell the progress bar: The value on this page is 30%, the value on the previous page was 20%, and when we're done with the selection sequence, we shall arrive at 40%.

If you combine that with the PHP command on the next page...

option('progress', 40);

And that on the page after:

option('progress', 41);

Everything will run quite smooth. As I tried to explain, the issue is that the pages as so very different in their length.

> My pictures and the bogus items both need to be completely randomized.

One more argument to put them all together into ONE question and then take care about randomization.

The trick is this: You create two series of randomized numbers. You can do this via two random generators. One for the items (e.g., 1-60) and one for the bogs items (e.g. 61-64). As soon as you have these series in randomized order you use array_slice() and array_merge() to get this order:

* First 15 (e.g.) items from Item-Array
* First element from the Bogus-Array
* Second 15 (e.g.) items from Item-Array
* Second element from the Bogus-Array
etc.

May I suggest we create a new question on the rotation part? The coments down here are getting somewhat stuffed.
by s219203 (310 points)
I've created another thread: https://support.soscisurvey.de/?qa=42961/rotation-randomization-of-items-into-blocks

"Rotation/Randomization of items into blocks"

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

...