Search code examples
randomsurveyqualtrics

Display stimuli randomly conditioned on previous stimuli in qualtrics


I use qualtrics for displaying stimuli to participants. I categorized my stimuli on two dimensions.

The first dimension is represented by a letter (a,b,c)

The second dimension is represented by a number (1,2,3)

So each stimulus can be one of the nine combinations letters * number (e.g., a1, a2, a3, b1, b2, etc). Each subject should see 3 stimuli, each of the 3 letters and each of the 3 numbers. Yet, the letters and numbers should appear only one time. So for example, one participant will see {a1,b2,c3} and another will see {c1,b3,a2}. But I don't want a participant to see {a3, b2, a1}. There are 36 possible combinations. So of course I can create 36 blocks and display them at random, but I want to avoid this because each stimulus is complicated and errors will occur.

What I would like is to tell qualtrics first to randomly display one of the 9 possible combinations (3*3). Then, to randomly display one of the 4 possible combination that remains (2*2). Then to display the last stimulus that sample a second stimulus that remains.

Any idea how doing that in qualtrics?


Solution

  • The way we handle this in a Qualtrics survey is by storing the data on what has happened via JavaScript in the header. This makes the "history" available in the next question, and thus it could inform your random draw by eliminating some options. Hope that works for you!

    When loading the page, add JS to the question:

    Qualtrics.SurveyEngine.addOnload(function() {var that = this; yourFunction(that);});

    yourFunction should be declared in the Qualtrics Header (available via "look & feel") where you can enter JavaScript:

    saving embedded data to pass on: Qualtrics.SurveyEngine.setEmbeddedData("yourvarname", yourvardata);

    retrieving data: Qualtrics.SurveyEngine.getEmbeddedData('yourvarname')

    best, marijn