Multiple correct response


Author
Message
Psycho
Psycho
Partner Member (530 reputation)Partner Member (530 reputation)Partner Member (530 reputation)Partner Member (530 reputation)Partner Member (530 reputation)Partner Member (530 reputation)Partner Member (530 reputation)Partner Member (530 reputation)Partner Member (530 reputation)
Group: Forum Members
Posts: 2, Visits: 7
Hi All!

I'm a new member so forgive me if my question is lame, but I couldn't find a solution for my problem.
I'm trying to program a reaction time based sensomotory coordination task: presenting a stimuli (a random number from 1 to 4), and the subject must push the corresponding buttons as soon as possible.

I've already created a fully functioning version in which there's only one correct answer
(so for example the number "1" comes up on the screen and pressing the button 1 means the correct response, whereas pushing 2, 3, 4, or no response is incorrect.)

What I would like to create is a version in which the subject must press two buttons simultaneously, one with the left and one with the right hand. For example: when the number 1 comes up on the screen, you must press "e" with your left, AND "i" with your right hand at once (I just mentioned these letters randomly, imagine both of them labeled "1" on a special keyboard).

Is it possible?
I tried this (imagine that e-r-d- f is 1-2-3-4 with left, and i-o-k-l is 1-2-3-4 with right hand):

<trial one_1>
/ stimulusframes=[1=one]
/ validresponse = ("e", "r", "d", "f", "i", "o", "k", "l", noresponse)
/ correctresponse = ("e" & "i")
/ trialduration = 1500
</trial>

But it's not working, seems as both answers are registered as correct, even if you only press one of them.
Of course somehow I think I'll also need to specify the lenght of time gap between button presses which is still considered to be acceptable. I'd be grateful for that as well.

Thanks in advance for your help!
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
There are several issues here:

#1: The general flaw in the <trial> code you posted is the /validresponse attribute. It specifies the keys which are considered as valid response options. A press on *either one of them* will terminate the trial. So, you need not only care about evaluating *correct* responses, but first and foremost about *valid* responses.

#2: By default, a <trial> element collects a *single* response (here: a single keypress), not several. It is possible to get a <trial> to register several, but that requires some trickery using /isvalidresponse and /iscorrectresponse. The simple /validresponse and /correctresponse attributes are not applicable.

#3: You will have to work with keyboard scancodes -- not "literal" key values ("e", "i", etc.) -- because ultimately what the <trial>'s response property returns. See the "Keyboard Scan Codes" topic in the documentation as well as Tools -> Keyboard Scancodes... in Inquisit Lab's menu.

#4: There remains a certain risk that one of the key presses is not detected *if* both keys are indeed pressed at the exact same time. I don't see any sure-fire way to eliminate this risk entirely.

A short example is below:

<values>
/ first_key = 0
/ first_key_latency = 0
/ second_key = 0
/ second_key_latency = 0
/ correctkeys = ""
</values>

Relevant scancodes:
e = 18
r = 19
d = 32
f = 33

i = 23
o = 24
k = 37
l = 38

<trial one_1>
/ ontrialbegin = [values.first_key=0; values.first_key_latency=0;
    values.second_key=0; values.second_key_latency = 0;
    values.correctkeys = "18, 23"; ]
/ stimulusframes=[1=one]
/ validresponse = (18,19,32,33,23,24,37,38)
/ isvalidresponse = [if(values.first_key==0) {
    values.first_key=trial.one_1.response;
    values.first_key_latency=trial.one_1.latency;
    false; };
    if (values.first_key != 0 && trial.one_1.latency>values.first_key_latency) {
    values.second_key=trial.one_1.response;
    values.second_key_latency = trial.one_1.latency;
    false; };
    values.first_key != 0 && values.second_key != 0]
/ iscorrectresponse = [contains(values.correctkeys, values.first_key) && contains(values.correctkeys, values.second_key)]
/ trialduration = 1500
</trial>

<text one>
/ items = ("1")
</text>

<block myblock>
/ trials = [1-5 = one_1]
</block>

<data>
/ columns = [date time subject blocknum blockcode trialnum trialcode response latency correct values.first_key values.first_key_latency values.second_key values.second_key_latency]
/ separatefiles = true
</data>

Hope this helps.

Psycho
Psycho
Partner Member (530 reputation)Partner Member (530 reputation)Partner Member (530 reputation)Partner Member (530 reputation)Partner Member (530 reputation)Partner Member (530 reputation)Partner Member (530 reputation)Partner Member (530 reputation)Partner Member (530 reputation)
Group: Forum Members
Posts: 2, Visits: 7
Thank you very much for your help! :)
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search