recognizing correct response for open-ended trial


Author
Message
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: 13K, Visits: 108K
It's quite simple. /ontrialend attributes are executed *at the very end of the trial*, i.e., *after* any response evaluation (e.g. via /iscorrectresponse) has occurred.

Since you do all the things that *would* be necessary to determine response correctness /ontrialend, it is bound to fail. The information isn't available at the point in time correctness evaluation happens.

Instead you'll want to do something along the lines of

<values>
/ digitstring = ""
/ correctstring = ""
</values>

<block myblock>
/ trials = [1-4=practice_add3]
</block>

<openended practice_add3>
/ ontrialbegin = [values.digitstring=""; values.correctstring="";]
/ ontrialbegin = [values.digitstring = concat(concat(concat(text.digit1.nextvalue,text.digit2.nextvalue),text.digit3.nextvalue),text.digit4.nextvalue);
    values.correctstring = replaceall(values.digitstring,"5","8");
    values.correctstring = replaceall(values.correctstring,"1","9");
    ]
/ stimulustimes = [0 = digit1 , digit2, digit3, digit4, debug]
/ mask = positiveinteger
/ inputdevice = keyboard
/ charlimit = 4
/ size = (15%, 2.5%)
/ validresponse = (anyresponse)
/ iscorrectresponse = [openended.practice_add3.response==values.correctstring]
/ buttonlabel = "Press CTRL+ENTER to continue"
</openended>

<text digit1>
/ items = ("1","2","3","4","5","6","7","8","9")
/ position = (40%,40%)
</text>

<text digit2>
/ items = ("1","2","3","4","5","6","7","8","9")
/ position = (45%,40%)
</text>

<text digit3>
/ items = ("1","2","3","4","5","6","7","8","9")
/ position = (55%,40%)
</text>

<text digit4>
/ items = ("1","2","3","4","5","6","7","8","9")
/ position = (60%,40%)
</text>

<text debug>
/ items = ("Digit String = <%values.digitstring%> | Correct String = <%values.correctstring%>")
/ position = (50%, 5%)
</text>


Marina
Marina
Partner Member (976 reputation)Partner Member (976 reputation)Partner Member (976 reputation)Partner Member (976 reputation)Partner Member (976 reputation)Partner Member (976 reputation)Partner Member (976 reputation)Partner Member (976 reputation)Partner Member (976 reputation)
Group: Forum Members
Posts: 6, Visits: 12
Hi,
I am putting together an experiment that is a variation of the digit span memory task.
Participants are presented with a 4-digit number, and have to enter the digits in a text box, but replace all 1s with 9s and 5s with 8s. (so if they see 2343, they would enter 2343, but if they see 2345 they would enter 2348)
I want to evaluate whether participants got the correct answer on each trial, but am running into some problems. 

Here is some of the syntax I use (I could send you the full syntax if you want)

<expressions>
/fullnumber = evaluate (text.digit1.currentitem*1000 + text.digit2.currentitem*100 + text.digit3.currentitem*10 +text.digit4.currentitem)
/d1 = values.d1
/d2 = values.d2
/d3 = values.d3
/d4 = values.d4
/fullcorrect = (values.d1*1000) + (values.d2*100) +(values.d3*10) +values.d4
/correctanswer = values.correctanswer
</expressions>

<openended practice_add3>
/ stimulustimes = [0 = signal; 1000 = eraser; 1100 = digit1 , digit2, digit3, digit4; 3100 = eraser, response]
/ mask = positiveinteger
/ inputdevice = keyboard
/ charlimit = 4
/ size = (15%, 2.5%)
/ validresponse = (anyresponse)
/timeout = 7000
/ontrialend = [if (text.digit1.currentitem !=5 && text.digit1.currentitem !=1) values.d1 = text.digit1.currentitem; if (text.digit1.currentitem ==5) values.d1 = 8; if (text.digit1.currentitem ==1) values.d1 = 9]
/ontrialend = [if (text.digit2.currentitem !=5 && text.digit2.currentitem !=1) values.d2 = text.digit2.currentitem; if (text.digit2.currentitem ==5) values.d2 = 8; if (text.digit2.currentitem ==1) values.d2 = 9]
/ontrialend = [if (text.digit3.currentitem !=5 && text.digit3.currentitem !=1) values.d3 = text.digit3.currentitem; if (text.digit3.currentitem ==5) values.d3 = 8; if (text.digit3.currentitem ==1) values.d3 = 9]
/ontrialend = [if (text.digit4.currentitem !=5 && text.digit4.currentitem !=1) values.d4 = text.digit4.currentitem; if (text.digit4.currentitem ==5) values.d4 = 8; if (text.digit4.currentitem ==1) values.d4 = 9]
/iscorrectresponse = [evaluate (openended.practice_add3.response - expressions.fullcorrect)==0]
/ontrialend = [values.correctanswer = expressions.fullcorrect]
/ontrialend = [if (openended.practice_add3.correct == true) values.numcorrectadd3practice = values.numcorrectadd3practice + 1]
/ buttonlabel = "Press CTRL+ENTER to continue"
/ errormessage = true(error,400)
/correctmessage = true(yescorrect, 400)
</openended>

digit1 through digit4 are randomly generated digits. I know the program is correctly recording the presented numbers, what should be the 'correct' response, and the response I input (because I ask for the relevant expressions to be saved in the output file), but it is not recognizing correct responses as being correct, so I think my problem is with the /iscorrectresponse line.

I also tried the following:
 /iscorrectresponse = [openended.practice_add3.response == expressions.fullcorrect]
and that does not work either.

Any other suggestions would be appreciated! 
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search