AAT - including final response as the correct response, including error message


Author
Message
becgwin
becgwin
Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)
Group: Forum Members
Posts: 53, Visits: 313
Hi,

I need to adapt the AAT joystick script to nominate the final response as the correct response (instead of the initial response - although I still need the IR recorded) and also to give an error message after the completion of the trial (real and practice) if the participant pushed/pulled incorrectly.  I will then repeat the trial.

While I can work out how to insert an error message within the trial when the IR is the correct response (based on the practice trials), I am not sure how to do this after the trial has ended. I am also having trouble working out how to swap the correct response from the IR to the final response as I can't  see where the correct response is set in the script.

Can you please give me some tips? 

Thanks very much.

Rebecca

Dave
Dave
Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)
Group: Administrators
Posts: 11K, Visits: 65K
The initial response is recorded in values.initialresponse. Its correctness is stored in values.correct. Both happens in the respective <trial> elements. E.g.

<trial AAT_1>
...
/ iscorrectresponse = [(values.expcondition == 1 && trial.AAT_1.response == "forward") ||
                                (values.expcondition == 2 && trial.AAT_1.response == "back")]
...
/ ontrialend = [values.correct = trial.AAT_1.correct]
...
/ ontrialend = [if (trial.AAT_1.response == "forward") values.initialresponse = "PUSH"
                        else values.initialresponse = "PULL"]
</trial>

The final response is recorded in values.finalresponse. That happens in the "increase" and "decrease" <trial> elements:

<trial increase>
...
/branch = [if (joystick.y >= 1000)
                {values.joystick_y = joystick.y; values.endtime = script.elapsedtime; values.finalresponse = "PULL"; trial.endincrease}]
...
</trial>

<trial decrease>
...
/branch = [if (joystick.y <= -1000)
                {values.joystick_y = joystick.y; values.endtime = script.elapsedtime; values.finalresponse = "PUSH"; trial.enddecrease}]
,,,
</trial>

<trial endincrease> or respectively <trial endincrease> is then run as the final trial in that sequence. You would put your evaluation of the final response as well as the display of the error message in those two <trial> elements -- <trial endincrease> and <trial enddecrease>. The logic would be largely identical to the logic outlined above dealing with the initial response.

becgwin
becgwin
Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)
Group: Forum Members
Posts: 53, Visits: 313
Hi Dave,

Thanks for the advice.  I've tried a few different ways to make this work and the best was the following pretty much as per your recommendation.  I added the correctresponse statement to the endincrease and enddecrease trials, and deleted it from any earlier trials.  For example here is what I added to the endincrease trial:

/iscorrectresponse = [(values.expcondition == 1 && values.targetformat == "p" && values.finalresponse == "PULL") ||
                        (values.expcondition == 2 && values.targetformat == "l" && values.finalresponse == "PULL")]

/errormessage = true(error,0)

The problem however is that the error message (the type and not the rectangle it appears in?) disappears very quickly (it basically flashes) so that you end up with the picture with a white box inset, but no error message.  I thought that by setting the errormessage duration to '0' it would display the stimulus for the duration of the trial i.e. until you release the joystick.

Can you tell me how to ensure that the error (type) stays on the screen as long as the image does?

As an alternative I tried to create a branch in the enddecrease/endincrease trials so that if it was correct it went to the joystick rest trial and if not to an error trial but that caused multiple issues (including how to go back to the next AAT trial after the error trial).  Ideally this would probably be a better option but I am not sure how to do this - would you be able to give me any pointers?  I looked at the SCIAT script which flashes a red X if there is an error after the picture, but this was specified at the block level and when I tried this for the AAT it gave me an error every time - possibly because there are multiple trials (e.g. AAT, increase/decrease, endincrease/decrease)?

I would really appreciate any further advice you could give me.

Kind regards,

Rebecca

Dave
Dave
Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)
Group: Administrators
Posts: 11K, Visits: 65K
The trial has a /timeout set to zero. I.e., it displays the image, immediately ends, displays the specified errormessage, erases it (<text error> is not set to /erase=false), which is what the white rectangle is, and then invokes the joystickrest trial. Your error message flashes only briefly because that's what you specified:

/errormessage = true(error,0)

a zero duration. Specify a larger duration

/errormessage = true(error,500)

and it will remain on-screen longer along with the image.

The /branching option you mention is also possible. You /branch conditionally. Suppose you have set up <trial errortrial>. Then you do:

<trial endincrease>
...
/branch = [if (trial.endincrease.error) trial.errortrial else trial.joystickrest]
...
</trial>

with

<trial errortrial>
...
/ branch = [trial.joystickrest]
...
</trial>

becgwin
becgwin
Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)
Group: Forum Members
Posts: 53, Visits: 313
Thanks again Dave.

I tried both versions.  In the first case it works if you extend the duration to 500 and release the joystick in a timely fashion, but if you keep holding the joystick the error message disappears but the image remains on screen.  I understand that the error remains on screen for 500 as specified,  but is there a way to ensure that both the error message and the image stay on screen as long as the participant is holding the joystick?  I thought by setting 0 as the error message duration you were specifying that the error stays on screen for the duration of the trial (that is what it says in the help section).  If not 0 is there any other way of ensuring this can happen?

The second version with a separate error trial, which would probably be better for me, is also not working!  What happens is that the error message appears over the image for the specified presentation time, not after the image has disappeared which is what I thought I was specifying, and then the image stays on screen even when you have released the joystick.  To remove the image you need to tap the joystick again.  I was wondering if by branching back to the joystick rest trial after the error trial you are requiring the participant to move the joystick again (no matter where the joystick is - still extended or released)?  But that still doesn't explain why the image still stays on the screen after the error message has disappeared in the first place?   As an example, here is the code I have for the practice increase trials:

<trial practiceincrease>
/ ontrialbegin = [picture.practicetarget.height = picture.practicetarget.height + values.joystick_change/1000 * expressions.maxheightchange_px]
/ stimulusframes = [1 =  practicetarget]
/validresponse = (change)
/ monkeyresponse = ("back", "forward")
/ontrialend = [values.joystick_change = abs(values.joystick_y - joystick.y)]
/ontrialend = [trial.practiceincrease.resetstimulusframes()]
/branch = [if (monkey.monkeymode == 1) {values.endtime = script.elapsedtime; values.finalresponse = "PULL"; trial.intertrialinterval}]
/branch = [if (joystick.y >= 1000)
                {values.joystick_y = joystick.y; values.endtime = script.elapsedtime; values.finalresponse = "PULL"; trial.endincrease_practice}]
/branch = [if (joystick.y >= values.joystick_y)
                {values.joystick_y = joystick.y; trial.practiceincrease}]
/branch = [if (joystick.y < values.joystick_y)
                {values.joystick_y = joystick.y; values.changedirection += 1; trial.practicedecrease}]
/recorddata = false
</trial>

<trial endincrease_practice>
/iscorrectresponse = [(values.expcondition == 1 && values.targetformat == "p" && values.finalresponse == "PULL") ||
                        (values.expcondition == 2 && values.targetformat == "l" && values.finalresponse == "PULL")]
/ branch = [if (trial.endincrease_practice.error) trial.error else trial.joystickrest]
/ontrialbegin = [picture.practicetarget.height = picture.practicetarget.height + values.joystick_change/1000 * expressions.maxheightchange_px]
/stimulusframes = [1 = eraser, practicetarget]
/timeout = 0
/recorddata = false
</trial>

<trial error>
/stimulusframes = [1 = error]
/timeout = values.errorpresentationtime
/correctresponse = (noresponse)
/branch = [trial.joystickrest]
</trial>

<trial joystickrest>
/isvalidresponse = [trial.joystickrest.response =="change"]
/branch = [if (joystick.y == 0 && joystick.x == 0) trial.InterTrialInterval else trial.joystickrest]
/recorddata = false
/ monkeyresponse = ("change")
</trial>

I did try taking out the branching in the error trial, but as result the next image appeared over the old image (which was still on the screen ...aargh!!). 

Do you have any suggestions?  The major issue seems to be how to either link the image and the error message so they disappear together in the first scenario, or in the second (preferred method) how to finish the trial (whether it is correct or incorrect) and then go to the error message trial after.  If you do that however what do you branch back to after the error trial? I tried the putting a branch to the error message in the joystickrest trial (see below) but it just ended up with no error message and the image staying permanently on the screen!

<trial joystickrestprac>
/isvalidresponse = [trial.joystickrest.response =="change"]
/branch = [if (joystick.y == 0 && joystick.x == 0) trial.InterTrialInterval else trial.joystickrest]
/ branch = [if (trial.endincrease_practice.error) trial.error]
/recorddata = false
/ monkeyresponse = ("change")
</trial>

<trial error>
/stimulusframes = [1 = error]
/timeout = values.errorpresentationtime
/correctresponse = (noresponse)
</trial>



Thanks very much Dave - I'm really not sure how to proceed so any help would be much appreciated.

Rebecca





Dave
Dave
Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)
Group: Administrators
Posts: 11K, Visits: 65K
Since you have expressed a clear preference for the 2nd option (error message in a separate <trial>), let's deal with that one only.

#1: The "target" <picture> elements are all set to /erase = false. That is why they remain on-screen even after a trial has ended; they are supposed to and they need to -- otherwise you'd see the image flickering like crazy during the trials de- or increasing its size.

#2: To get rid of the image in the error trial, you need to overwrite the entire screen with a blank shape. The script already contains and uses such a shape, specifically <shape eraser>. I.e., you do

<trial error>
/stimulusframes = [1 = eraser, error]
...
</trial>

#3: In addition, you'll want to use /trialduration, *not* /timeout, and specify noresponse as /validresponse, *not* correctresponse:

<trial error>
/stimulusframes = [1 = eraser, error]
/trialduration = values.errorpresentationtime
/validresponse = (noresponse)
...
</trial>

#4: Finally, you'll want to /branch from the error trial to the joystickrest trial as detailed in my previous reply. You *do not* want to modify the joystickrest trial in any way, i.e., revert any changes you may have made to it.

<trial error>
/stimulusframes = [1 = eraser, error]
/trialduration = values.errorpresentationtime
/validresponse = (noresponse)
/branch = [trial.joystickrest]
</trial>
becgwin
becgwin
Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)
Group: Forum Members
Posts: 53, Visits: 313
Thanks so much Dave - that is a great help.  Just one more issue!  It is working in terms of the image disappearing and the error message flashing after that, but then after an error trial it still doesn't go the next image unless you actually move the joystick and it comes back to a resting position.  I suspect this is because even though you have let go of the joystick after moving the image, by branching from the error trial to the joystick trial you are asking again that the participant move the joystick to a resting position.  I removed branching to the joystick from the error trial so that it is as below, and it seems to work as long as the participant returns the joystick to a rest position.  My concern is that the program continues to run even if the joystick is not in the rest position after the error trial. Can you see a way around this?  Could you put something in the beginning trial e.g. practicetrialA and B (or AAT1 to AAT8) to specify that the joystick must be in a rest position before the trial can begin?

<trial error>
/stimulusframes = [1 = eraser, error]
/trialduration= values.errorpresentationtime
/validresponse = (noresponse)
</trial>

Thanks Dave.

Rebecca

Dave
Dave
Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)Supreme Being (913K reputation)
Group: Administrators
Posts: 11K, Visits: 65K
You could have the joystickrest trial itself display some message to that effect. E.g.

<trial joystickrest>
/ stimulusframes = [1=movetorestposition]
/isvalidresponse = [trial.joystickrest.response =="change"]
/branch = [if (joystick.y == 0 && joystick.x == 0) trial.InterTrialInterval else trial.joystickrest]
/recorddata = false
/ monkeyresponse = ("change")
</trial>

<text movetorestposition>
/ items = ("Please move the joystick to its resting position to start the next trial")
/ erase = false
</text>

becgwin
becgwin
Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)
Group: Forum Members
Posts: 53, Visits: 313
Thanks Dave.  I just tried it but the problem is that on the error trials you get the message when the joystick is actually already in rest position so it might be a bit confusing (to move on they need to actually first move the joystick away from resting and then back to resting position). The message also appears on every trial, including the correct trials where it appears embedded in the image.  An alternative may be to branch to the normal joystick trial when correct and create a new joystick error trial  when there is an error prompting people to just move the joystick and return to position (see below). 

<trial joystickresterror>
/ stimulusframes = [1=eraser, movetorestposition]
/isvalidresponse = [trial.joystickrest.response =="change"]
/branch = [if (joystick.y == 0 && joystick.x == 0) trial.InterTrialInterval else trial.joystickrest]
/recorddata = false
/ monkeyresponse = ("change")
</trial>

<text movetorestposition>
/ items = ("Please move the joystick and then return to resting position to start the next trial")
/ erase = false
</text>

I am just concerned that this deviates from any version of the AAT that I have seen, and that the extra movement of the joystick might affect overall task performance.  I am actually trying to emulate Wiers' last version of the AAT which gives error feedback after each incorrect trial and then repeats the error trials.  Can you think of any other way apart from the above of going straight from the error feedback to the next trial without having to move the joystick again?

Thanks so much for your help Dave.

Rebecca



becgwin
becgwin
Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)Guru (5.8K reputation)
Group: Forum Members
Posts: 53, Visits: 313
Hi Dave,

Sorry - one more thing!  When I set up the two joystickrest trials (one for an error and one for the correct trials), if an error is made on the first trial, then the programme can't move on - i.e. the screen gets stuck on the movetorestposition message.  However, if the first trial is done correctly it runs as you would expect.  I'm not sure why this happens?

Cheers,

Rebecca


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search