Randomization of 30 image-sentence pairs while controlling for gender in a within-subject design without repetition. | XM Community
Skip to main content
Solved

Randomization of 30 image-sentence pairs while controlling for gender in a within-subject design without repetition.

  • February 4, 2025
  • 1 reply
  • 19 views

Forum|alt.badge.img

Hi there,

I have 15 photos of women, 15 photos of men, and 30 sentences describing actions. I need to create randomized pairs where a photo is displayed with a sentence below it, and participants will evaluate the person depicted using a Likert scale. Participants must see all 30 pairs. The problem is that if the photo is of a woman, the sentence needs to be adapted to the female version (e.g., "She brushes her teeth every night"), and if the photo is of a man, the sentence needs to be adapted to the male version (e.g., "He brushes his teeth every night"). Each sentence can only appear once — either in the female or male version, but not both.

Participants should not see any repeated photos or sentences. I want the pairs to be randomized so that any photo can be paired with any sentence from the set. Additionally, I need to record which photo and sentence were shown for each evaluation in the dataset.


What approach can I use to achieve this?

Best answer by TomG

@sigpa,

I answered a very similar question from you last week, and the answer is pretty much the same. The only wrinkle is the gender piping.

  1. Add a question before your loop and merge with 30 choices for the sentences and randomize the choices. Within the sentences add a <span> with a class for he/she and another one for his/her. Do not force response. Add JS to loop through the choices and save the sentences to embedded data fields for each choice (e.g. choice1, choice2, …, choice30). Hide the question with JS (and click next if it is on a page by itself)
  2. In your loop & merge setup add 30 rows with the image url in field 1, alt text in field 2, he/she is field 3, and his/her in field 4. In field 5 pipe your randomized sentence (e.g. ${e://Field/choice1}). Randomize your loop.
  3. Pipe the loop and merge fields into the html of your evaluation question. 
  4. Add JS to update the text inside the <span> tags.

Example sentence html:

<span class="heShe"></span> brushes <span class="hisHer"></span> teeth every night

JS for text replacement:

Qualtrics.SurveyEngine.addOnload(function() {
  var q = jQuery(this.getQuestionContainer());
  q.find(".heShe").text("${lm://Field/3}");
  q.find(".hisHer").text("${lm://Field/4}");
});

 

View original

1 reply

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5918 replies
  • Answer
  • February 4, 2025

@sigpa,

I answered a very similar question from you last week, and the answer is pretty much the same. The only wrinkle is the gender piping.

  1. Add a question before your loop and merge with 30 choices for the sentences and randomize the choices. Within the sentences add a <span> with a class for he/she and another one for his/her. Do not force response. Add JS to loop through the choices and save the sentences to embedded data fields for each choice (e.g. choice1, choice2, …, choice30). Hide the question with JS (and click next if it is on a page by itself)
  2. In your loop & merge setup add 30 rows with the image url in field 1, alt text in field 2, he/she is field 3, and his/her in field 4. In field 5 pipe your randomized sentence (e.g. ${e://Field/choice1}). Randomize your loop.
  3. Pipe the loop and merge fields into the html of your evaluation question. 
  4. Add JS to update the text inside the <span> tags.

Example sentence html:

<span class="heShe"></span> brushes <span class="hisHer"></span> teeth every night

JS for text replacement:

Qualtrics.SurveyEngine.addOnload(function() {
  var q = jQuery(this.getQuestionContainer());
  q.find(".heShe").text("${lm://Field/3}");
  q.find(".hisHer").text("${lm://Field/4}");
});

 


Leave a Reply