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

This is a continuity of this discussion.

One more argument to put them all together into ONE question and then take care about randomization. ... create two series of randomized numbers ...use array_slice() and array_merge()...

This seems like a good alternative to my original design!
Could you please explain more.

Here are some questions/concerns that are coming to mind as of now:

  • Right now, my picture items are under the same selection sequence question, and my bogus items are separate selection questions (under the same section). Do I understand that they should all be under the same selection sequence question?
  • Would this mean the task is grouped under a single page in the questionnaire with a PHP code splitting the items into image blocks and bogus items on different visual pages for the participants?
  • A potentially complexifying element is that the bogus items act as filter question; if someone answers incorrectly, their survey is ended. I would thus like to keep this filtering element.
closed with the note: Answered

1 Answer

0 votes
by SoSci Survey (305k points)
selected by s219203
 
Best answer

A general condition to put all items and bogus items into one question is that there are no more than 99 of them. Yet, you should not reach that limit anyway, because respondents' attention will be lost on such a long, boring way, anyway.

Right now, my picture items are under the same selection sequence question, and my bogus items are separate selection questions (under the same section). Do I understand that they should all be under the same selection sequence question?

Yes, that would make things easier, especially the transition between bot item "types".

Would this mean the task is grouped under a single page in the questionnaire with a PHP code splitting the items into image blocks and bogus items on different visual pages for the participants?

Are we talking about a selection sequence? If yes, then all items would be on a single page in a single question, but would be presented one after another.

Using loopPage() would also allow different split variants for other types of questions.

A potentially complexifying element is that the bogus items act as filter question; if someone answers incorrectly, their survey is ended. I would thus like to keep this filtering element.

You will have to do this via JavaScript, if everything is on one page (Selection Sequence JavaScript). An alternative would be to present items + one bogus on one page, and work with loopToPage() to allow for a PHP filter after each such block. But let us postpone this filter stuff, an concentrate on the presentation, first.

Here is a good point to get started: Single Pages at Fixed Position - actually it's not such a big difference, if you rotate pages or items. The main difference is that you use question() instead of setPageOrder().

by s219203 (310 points)
Ok! I am sorry for all the back-and-forth, but I might need a bit more step-by-step instructions.

 - All elements (1-94) are under the same selection sequence question (IT03).
 - I have 2 random generators. One for the pictures (RG01 with list from 1-90) and one for the bogus items (RG02 with list from 91-94).
 - I have only one page left under "compose questionnaire" for the picture task. Which should include a code to show the 8 pages/blocks (4 bogus items in-between 4 blocks of pictures).

Looking at "Single Pages at Fixed Position" (and based on your previous answer indicating I should use array_slice() and array_merge()), I would think the code would look something like the example they provide:

-------------------------------------------
question('RG04');
$pages = valueList('RG04', 'label');
$pageOrder = array_merge(
  array_slice($pages, 0, 2),
  ['gap'],
  array_slice($pages, 2)
);
setPageOrder($pages, 'posttest');
-------------------------------------------

How do I insert both random generators and both arrays (bogus and images) in the code?
by SoSci Survey (305k points)
Sound good so far :)

> How do I insert both random generators and both arrays (bogus and images) in the code?

First, you get the two arrays:

$items = array_values(valueList('RG01'));
$bogus = array_values(valueList('RG02'));

The array_values() here is just to avoid issues with the indices of the valueList() results. Now you can mix these array however you like:

$allItems = array_merge(
  array_slice($items, 0, 20),
  array_slice($bogus, 0, 1),
  array_slice($items, 20, 20),
  array_slice($bogus, 1, 1),
  array_slice($items, 40, 20),
  array_slice($bogus, 2, 1),
  array_slice($items, 60, 20),
  array_slice($bogus, 3, 1),
  array_slice($items, 80)
);

And then let's take a look (just to be sure) and display the selection sequence:

debug($allItems);
question('IT03', $allItems);
by s219203 (310 points)
edited by s219203
Thank you for this! I did try a similar code yesterday and it did not work.
I tried it again and the same issue arise.

My RGs are on the page before the one with the picture task.
The following PHP code is on the page of the task with nothing else:

$items = array_values(valueList('RG01'));
$bogus = array_values(valueList('RG02'));
$allItems = array_merge(
  array_slice($items, 0, 25),
  array_slice($bogus, 0, 1),
  array_slice($items, 25, 25),
  array_slice($bogus, 1, 1),
  array_slice($items, 50, 20),
  array_slice($bogus, 2, 1),
  array_slice($items, 70, 20),
  array_slice($bogus, 3, 1)
);
debug($allItems);
question('IT03', $allItems);

The pictures and bogus items do appear randomly, but it is never the same number of them. For example, 6 pictures will appear, then a bogus, then 1 picture, then a bogus, then 30 pictures, etc. The next time I try it, it might be very different number of pictures in-between the bogus items...

What would you suggest is the problem?
by SoSci Survey (305k points)
What does the debug information say - especially that caused by debug($allItems)?
by s219203 (310 points)
It just lists all the 93 items (because it starts at 0) in the order they appear.
"Content: 71, 17, 27, 53, ..."
by SoSci Survey (305k points)
The interesting question would be: What codes have been drawn from the two random generators and where are the bogus items located in that list? Woul you mind copy-pasting the three lists that this calls will show:

debug($items);
debug($bogus);
debug($allItems);

It's important to see at which location there problem arises.
by s219203 (310 points)
Ok, here's what the debug() calls:

For $items: 11, 88, 18, 9, 71, 43, 51, 84, 3, 19, 4, 20, 57, 36, 82, 89, 55, 49, 72, 68, 7, 46, 10, 12, 32, 13, 70, 61, 5, 52, 62, 31, 67, 76, 23, 45, 77, 24, 26, 59, 28, 85, 39, 38, 81, 22, 65, 54, 41, 50, 8, 35, 6, 83, 30, 79, 58, 29, 74, 69, 53, 86, 78, 37, 34, 40, 75, 2, 14, 48, 33, 90, 17, 15, 21, 64, 63, 16, 87, 60, 44, 56, 66, 1, 80, 42, 47, 27, 25, 73

For $bogus: 93, 91, 92, 94

For $allitems: 11, 88, 18, 9, 71, 43, 51, 84, 3, 19, 4, 20, 57, 36, 82, 89, 55, 49, 72, 68, 7, 46, 10, 12, 32, *93*, 13, 70, 61, 5, 52, 62, 31, 67, 76, 23, 45, 77, 24, 26, 59, 28, 85, 39, 38, 81, 22, 65, 54, 41, 50, *91*, 8, 35, 6, 83, 30, 79, 58, 29, 74, 69, 53, 86, 78, 37, 34, 40, 75, 2, 14, 48, *92*, 33, 90, 17, 15, 21, 64, 63, 16, 87, 60, 44, 56, 66, 1, 80, 42, 47, 27, 25, 73, *94*

I marked the bogus items with stars; the code is correct since it shows the items randomly and splits the images and bogus into the desired split arrays (i.e., 25, 25, 20, 20).

----

HOWEVER, this is what really happens as I look closer at the images and bogus displayed...

Items displayed: 53, 77, 55, 20, 82, ... [38 images in block 1], bogus 92, ...[31 images]..., bogus 93, [5 images], bogus 94, [7 images], bogus 91, [9 images].

The images don't correspond with the code the RG drew, and the split is incorrect...
by SoSci Survey (305k points)
Could it be that you told the question IT03 (in the question settings) to rotate the items?
by s219203 (310 points)
Oh wow! Yes I did... I've put it back to default and it works like a charm!
Items and bogus are randomized and split 25-25-20-20.

Looking through the Manual again, I read "Note: Response time can only be measured from the second sub-question onwards. If you want to measure response times, write an explanation (or something similar) for the first sub-question, and “Next” as the option."

I already had a text element saying "Let's start!", thus I tried incorporating this one into the code so that it is always shown first.

$items = array_values(valueList('RG01'));
$bogus = array_values(valueList('RG02'));
$start = array_values(valueList('RG03'));
$allItems = array_merge(
  array_slice($start, 0, 1),
  array_slice($items, 0, 25),
  array_slice($bogus, 0, 1),
  array_slice($items, 25, 25),
  array_slice($bogus, 1, 1),
  array_slice($items, 50, 20),
  array_slice($bogus, 2, 1),
  array_slice($items, 70, 20),
  array_slice($bogus, 3, 1)
);
question('IT03', $allItems);

It seems a bit complex, but I add the text element as a subquestion in IT03, created another random generator with only this one item, and ask the code to draw this item first and then follow with the 25-25-20-20. It works okay except the first image do appear for a few milliseconds before the "Let's start!", and then the screen goes back to the "Let's start!", the participant press "Next" and the first picture comes back. Any way we could have this run more smoothly (i.e., not see any glimpse of the image)? [I tried adding the item and question themselves in the code but it kept not working; that's why I opted for a more complex solution.]
by s219203 (310 points)
Moreover, there is the bogus items as filter questions. That is, if a participant select a specified answer, I want their interview to be done and for them to see a text element (a goodbye text, GT01).

You previously mentioned this would have to use Java, and copied this link: https://www.soscisurvey.de/help/doku.php/en:create:questions:selclick#respond_to_selection

I am quite unsure how to interpret this code. Any help appreciated!
by SoSci Survey (305k points)
To add single items (i guess it may have the ID 99) you won't need an array_slice()

$allItems = array_merge(
  [99],
  array_slice($items, 0, 25),
  array_slice($bogus, 0, 1),
  array_slice($items, 25, 25),
  // ...

>  if a participant select a specified answer, I want their interview to be done and for them to see a text element

Let's start a new question in the online support for that - it's getting buzy down here.

What you need is such a JavaScript code on the page, and it may have to say something like this:

function onSelect(evt) {
  var info = evt.detail;
  if ((info.item == 91) && (info.value != 2)) {
    SoSciTools.submitPage();
  }
}

This is for item 91 for now, you'll have to add conditions for the other 3 bogus items as well.

For the error message, you may need a little PHP filter on the next page.
by s219203 (310 points)
The code works okay using [99], but it still has this glitch with the first picture showing before the "Let's start!" text...

I'll start a related question on the bogus as filters.
by SoSci Survey (305k points)
> it still has this glitch with the first picture showing before the "Let's start!" text...

That could simply be the lag between loading the images and starting the question. One could build a workaround using JavaScript, but I have no ready-made fix for that.
asked Oct 4, 2022 in SoSci Survey (English) by s219203 (310 points)
closed Oct 7, 2022 by s219203
Selection Sequence Item as Filter Variable

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

...