Millisecond Forums

Help to modify the Nback in inquisit

By maddype - 10/16/2015


I recently attended a course in Inquisit and downloaded a trial version of it after. My goal was to create a modified version of the 2-back.  
That is, instead of matching the exact shape or letter, we want participants to match the stimulus based on its category
For example, rather than indicating whether the current letter (e.g., B) is the same letter as two trials back, we want participants to indicate whether the current letter is of the same category (i.e., vowel or noun) as the letter two trials back.
We want to have four different conditions. Rather than just having targets and non-targets, it would be "vowels targets", "vowels non-targets", "consonants targets" and "consonants non-targets".

I went through the nback version in the library and read through the codes, tried editing it and got nowhere.
I was wondering if this would be possible in inquisit and if so, how should i edit my codes to match this specification?
If I can get this to work, we would definitely be using inquisit to run our online studies for a version of this task.

Any help would be greatly appreciated.

Thanks in advance, 

By Dave - 10/16/2015

Of course this is possible. What you'll have to do is add additional variables (a <values> entry) that holds the stimuli's *category*, here: was the displayed letter a consonant or vowel. You can make that determination based on the item numbers, for example.

In non-target trials, display a vowel if the relevant stimulus (displayed 2 trials back) was a consonant. If the stimulus displayed 2-trials back was a consonant, display a vowel.

In target trials, do the opposite, i.e., if the relevant stimulus (displayed 2 trials back) was a consonant, display another consonant. If it was a vowel, display another vowel.

While I haven't tested it excessively and there may be lingering mistakes, the attached script should give you the basic idea re. how to go about implementing something like this. It is based on the "NBack Task (letter stimuli)" from . To run it, you need the images included in the archive.

Direct your attention to the new values with the "cat_"-prefix and the additional <list> elements (one holding the item numbers for consonants, another one for those of the vowels).

Hope this helps.
By maddype - 10/17/2015

Hi David,

Wow! That was a quick reply and extremely helpful! It's weekend here and I'm stealing time away from family to let you know -- you are awesome!!!!
I will try this out on Monday and see how it works!

Incredibly grateful,

By maddype - 10/17/2015

Sorry, I meant to say Dave. I got too excited and forgot to check before hitting send! Sincere apologies! :o

By maddype - 10/19/2015

Hi Dave,
I tried the experiment and it is working out quite well -- It is giving me the output that I need! Thank you for that -- that was really helpful! There is one bug that I did notice: the start trials (the first two trials of every block) are always categorised as vowels, but I think I can figure out how to fix that based on the codes for the target/nontarget trials. So that's really not a problem.

I do have a question regarding the kinds of trials chosen for the task. As of now, the program chooses 1/3 target trials and 2/3 nontarget trials -- this is regardless of whether the current stimulus presented is a vowel or a consonant.

However, we want to be able to control the proportion of trials for the four different conditions. For example, 1/4 of the trials should be "vowels targets", 1/4 of the trials should be "vowels nontargets", 1/4 of the trials should be "consonants targets", and 1/4 of the trials should be "consonants nontargets".

Is this possible? And if so, how would I be able to implement this?

Thanks again for the help! I'm grateful!

By Dave - 10/19/2015

I don't see any good way to do that. The problem is that those things are interdependent and heavily constraining: Only a subset of all possible sequences consisting of consonants and vowels will satisfy the criterion "there should be 25% vowel nontargets, 25% vowel targets, 25% consonant targets, 25% consonant nontargets".

To illustrate, suppose your sequence starts like this (v=vowel; c=consonant; 2-back):

trial: 1 - 2 - 3 - ...
cat:  v - v - ? - ...

Clearly, the 3rd trial can either be (1) vowel-target or (2) consonant-nontarget. It could not possibly be vowel-nontarget or consonant-target, so you're already constrained in your "random" selection at this point. Those constraints perpetuate as you move on. Suppose the 3rd trial is a vowel (and hence) target-trial.

trial: 1 - 2 - 3 - 4 - ...
cat:  v - v - v - ? - ...

The 4th trial, then, can again only be either a (1) vowel-target or (2) consonant-nontarget, but can't possibly be a vowel-nontarget or consonant-target.

You'd have to come up with a (deterministic) algorithm that reliably generates sequences that satisfy your constraints; I don't see that it can be done with simple random sampling conducted on-the-fly / at runtime.

If you can't come up with a suitable algorithm, you can alternatively construct a couple of such sequences (say 3 or 5) manually, chose one such sequence at random and then simply use sequential item selection.

You can find some general thoughts and remarks re. constrained random sampling here:

For an example of constrained sequence generation, see the AAT's sequence generation code:

Note though that the approach in the AAT has certain limits: In essence, it attempts to construct a conforming sequence one step at a time; if it hits a constraint violation, the entire sequence generation is restarted from scratch. The consequence is that the algorithm can take a long time to converge on a solution if too many constraints are imposed or even might not converge at all.

Hope this helps.
By maddype - 10/19/2015

Hi Dave,

Your response is indeed helpful. Now I know that the constraint we have created for the task makes programming it non-trivial. 
I will look into the links you have posted.  
But as of now, it seems more feasible to manually create different versions of this task offline (i.e., we manually order the trials in a certain sequence for each version),  and then randomly assign the different versions to the participants. 
Thanks again for your thoughts on this!