Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Clustered randomization of subquestions in array

  • dandreoli
  • dandreoli's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 week 4 days ago #265262 by dandreoli
Please help us help you and fill where relevant:
Your LimeSurvey version: [see right hand bottom of your LimeSurvey admin screen]
Own server or LimeSurvey hosting:
Survey theme/template:
==================
(Write here your question/remark)==================
(Write here your question/remark)Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey Cloud  Version 6.5.11
Own server or LimeSurvey hosting: limesurvey hosting
Survey theme/template: fruity
==================
Hi all, 

I am working on a survey for my PhD project. In this survey, I would like to have an array based question where respondents have to indicate on a 5pt Likert scale to what extent they agree with the presented statement. To limit response bias, I would like these statements to be presented in a random order. In the set of statements I would like to include however, some subtopic or clusters can be identified. Because it does not make sense for the respondent to first think of a statement related to topic A, then one on B followed by one on A again, I would like to see the randomization based on clusters. Such that both the order of the clusters, as well as the sub-questions within a cluster are random (see the small diagram below for a representation). Does anyone know how I can go about this? I already tried to create multiple arrays, but that way the general question also gets presented on a random location because it is attached to a single array. Any help is appreciated. 

Kind regards, 
Dennis Andreoli

Example: 3 clusters: with 3 statements each:Cluster A
  •                Statement A1
  •                Statement A2
  •                Statement A3
Cluster B
  •                Statement B1
  •                Statement B2
  •                Statement B3
Cluster C
  •                Statement C1
  •                Statement C2
  •                Statement C3
 Randomization as follows:FORMULATION OF QUESTION / EXPLAINATION OF TASKCluster B
  •                Statement B3
  •                Statement B2
  •                Statement B1
Cluster A
  •                Statement A2
  •                Statement A1
  •                Statement A3
Cluster C
  •                Statement C3
  •                Statement C1
  •                Statement C2

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 week 4 days ago #265268 by Joffm
Hi,
insert this script into the question text (source code mode) (adapted from an idea of Tony Partner)
Code:
<script type="text/javascript" data-author="Tony Partner">
  $(document).on('ready pjax:scriptcomplete',function(){
 
function shuffleArray(array) {
    for (var i = array.length - 1; i > 0; i--) {
        var j = Math.floor(Math.random() * (i + 1));
        var temp = array[i];
        array[i] = array[j];
        array[j] = temp;
    }
    return array;
}
    
    
    //Identify this question
    var thisQuestion = $('#question{QID}');
    var thisAnswerList = $('tr.answers-list:eq(0)', thisQuestion).parent();
 
    
    // Fill the arrays with the subquestion codes
    var arrayA=[1,2,3];
    var arrayB=[4,5,6];
    var arrayC=[7,8,9];
 
    
    shuffleArray(arrayA);
    shuffleArray(arrayB);
    shuffleArray(arrayC);
    var arrayZ=[arrayA,arrayB,arrayC];
    shuffleArray(arrayZ);
    
    var answerCodes = arrayZ.join(",").split(',');
    
    // Loop through the answer codes
    $.each(answerCodes, function(i, val) {
      // Move the answer item
      $(thisAnswerList).append($('tr.answers-list[id$="X{QID}'+val+'"]', thisQuestion));
    });
  });
</script>

 

Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose