Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Randomize and display two implicit association tests (IATs) from a pool of six IATs

Hi all,

I need some help with my IAT study. I have already done a study using a template of the IAT by Pinus and Bar-Anan (2017), which can be found at:

https://doi.org/10.17605/OSF.IO/V8YAJ

In my current study, I want to use this IAT six times, each time with a different theme (e.g., age, gender, etc.). In doing so, all six IATs (A-F) should be contained in one opensesame file. From this pool of six IATs, two IATs (e.g., A-F, E-B, D-C, F-A, etc.) should be randomly presented to the subjects. Since I am not an expert in programming with Python, I wanted to ask if anyone has ideas on how to solve my randomization problem?

• Hi @Sabrina,

I'm assuming that your 6 versions correspond to 6 distinct loops and that the trial sequence is otherwise identical in all versions (and so that you're using the same trial sequence and linked copies of the obkects within it).

The simplest way to achieve what you want is to write some code at the beginning of your task to randomly pick 2 values within an array formed by the numbers 1 to 6. Store the first one in a variable you could call task1 and tghe second in a variable task2. Let's imagine that task1 = 2 and task2 = 5. Then all you have to do is to make sure to encapsulate all 6 loops within a higher-level sequence and use the "run if" condition of the objects in that loop to run Loop1 if task1 = 1 or task2 = 1, the same with loop2 (to run if task1=2 or task2=2), etc. This way, only loops 2 and 5 will be presented to participants.

Python code such as this one should work:

```import random
while True:

break
```

Note that if you plan to run the task in a broawer, you'll need to use Javascript code to achieve the same result, not Python (as OSWeb does not support Python).

Hope this helps,

Fabrice.

• Hi Fabrice,

thanks for your quick reply. However, I realized that I can't try your solution yet, because another problem appeared. Namely, in the template before the IAT sequence, there are two inline_script_items with python code. In one (named "edit_this") you can adjust the stimulus material and the other (named "do_not_edit_this") contains important settings about the IAT. It's probably naive, but I thought that if I integrate the two inline_script_items with the IAT sequence into a new sequence, then I can include six ITAs one after the other this way (using the same trial sequence and linked copies of the objects within it). Unfortunately, I get error messages, such as that variables do not exist. However, this can't be because if I just play an IAT according to the structure in the template, then the IAT works without problems. So I think it has to do with the python code in the two inline_script_items and their position. However, I don't understand enough about programming to know what I need to change to get six IATs integrated into this template. Can you help me with this as well.

Additionally, I wanted to ask if your code for randomization also ensures that subjects do not get the same IAT twice?

Sabrina

• Hi @Sabrina,

Had not seen your replied. When replying in the forum, it is best to use handlers (start by typing "@" then the first few letters of your correspondent to select them from a drop-down menu). That wy, your correspondent gets notified that a message is there.

I don't really follow you description. I do not know what task your are referrting to exactxly (an IAT task can be programmed in multiple ways). It sounds as if you're starting from abn existing task and mofiying it. My advice is to take the time needed to really understand what each bit of the existing program doesm get familiar with Open Sesame, and then try modifications (small ones, little by little). I can't comment about the two lines of Python you're referring to because it entirely depends on what they contain, what they do and in what context. the error message indicates what's wrong: some variable iscalled that has not been defince yet at the timne the code is executed.

You may want to print your key variables to the console. It's a easy way to keep track of what your program does and it can help detect where problems come from.

Regarding the code I sent you, yes, it makes sure that two different tasks are selected> if you look carefully at the code you-ll see that this condition is implemente. the "while" loop will run until it is broken and it gets broken when vars.task1 and vars.task2 do not have the same value. (You might wantot read up a little on Python, at leasts the basics such as the "if", "while" functions. It'll come handy when you write your own code.

Hope this helps,

Fabrice.

• Hi, thanks for the tips and the explanation. The template I am talking about can be found here:

https://doi.org/10.17605/OSF.IO/V8YAJ

Maybe you can take a look at it if it is not too much bother for you. The problem is that the IAT sequence is preceded by two inline_script_items with python code that is very complex and not so easy to understand even if one tries.

I thought I could put the IAT sequence and the two inline_script_items into a new sequence to integrate this sequence six times linked, but this does not work. I appreciate any tips so I can keep trying until it works, just running out of ideas.

Thanks a lot

Sabrina

• Hi @Sabrina,

My recommendation woudl be to start from scratch rather than trying to retrofit an experiment designed with another structure and incluing quite a bit of Python code. I would start by building a simple IAT task, using Javascript if needed, and then when you get it to work properly, add in the different loops for the different versions of the IAT you want to use (anduse the soiution I suggested earlier to select two at random and present only those).

Hope this helps,

Fabrice.