MATLAB Answers

Stop signal task - pre error speeding

조회 수: 1(최근 30일)
Nina Auestad
Nina Auestad 2021년 4월 30일
댓글: Nina Auestad 2021년 5월 2일
I am working with a choice stop signal task, and need help extracting the RT before an erronous stop trial in order to investigate pre-error speeding.
This is how I extracted the goRT
for y = 1:size(,3)
idx = contains (eegdata.epoch(y).eventtype,'leftGoResponse') | contains(eegdata.epoch(y).eventtype,'rightGoResponse');
if (sum(idx)>0)
RT(y) = eegdata.epoch(y).eventlatency{idx};
RT(y)= nan;
goRT(s) = mean(RT,'omitnan')
The "names" for errounous stop trial is 'stopGoRightFA' and 'stopGoLeftFA'
So I need to extract the goRT before an errounous stop trial, and only that.
  댓글 수: 2
Nina Auestad
Nina Auestad 2021년 5월 1일
Thanks for your comment, allow me to clear things up:
I honestly don't remember why I put the sum in there, it works without. I just put the code there for visual reasons, so that people could see what I am working with. But that's not the problem.
I need to extract the reaction time for responses that were made before unsuccessfull stop trials. What I am struggling with is that the unsuccsessful stops are in a separate epoch. So I need something that will chech if epoch 1 contains 'leftgoresponse' or 'rightgoresponse', and if epoch 2 contains 'stopGoRightFA' and 'stopGoLeftFA' , then return the RT of epoch 1 (eventlatency).
I hope that clears things up?

댓글을 달려면 로그인하십시오.

채택된 답변

Jeff Miller
Jeff Miller 2021년 5월 2일
I think it would be cleanest to start by making a vector to indicate which trials precede unsuccessful stops, which can be done like this (if I have understood everything):
ntrials = size(,3);
PrecedeErrStop = false(ntrials,1);
for y=1:ntrials-1 % the last trial is not followed by anything
PrecedeErrStop(y) = (contains(eegdata.epoch(y).eventtype,'leftGoResponse') | contains(eegdata.epoch(y).eventtype,'rightGoResponse')) ...
& (contains(eegdata.epoch(y+1).eventtype,'stopGoRightFA') | contains(eegdata.epoch(y+1).eventtype,'stopGoLeftFA'));
%PrecedeErrStop is now a vector 1:ntrials where true indicates that the
%trial does precede a stop error and false indicates that it does not.
Then you can select out the RTs that do and do not precede stop errors like this:
PrecedeErrStopRTs = eegdata.epoch(PrecedeErrStop).eventlatency{1};
NotPrecedeErrStopRTs = eegdata.epoch(~PrecedeErrStop).eventlatency{1};
The PrecedeErrStop vector will also be useful if you want to compute ERPs for the error stop trials or to exclude the error stop trials from computation of regular ERPs.
  댓글 수: 1
Nina Auestad
Nina Auestad 2021년 5월 2일
Thank you!!
I managed to solve it before I saw your response. But I will also try out your code. Might be easier when working with the ERPs as you say!
%% unsuccessful stops
for y = 1:size(,3) - 1;
idx = any(strcmp(eegdata.epoch(y).eventtype,'leftGoResponse')) | any(strcmp(eegdata.epoch(y).eventtype,'rightGoResponse')) && any(contains(eegdata.epoch(y+1).eventtype,'stopGoRightFA')) | any(contains(eegdata.epoch(y+1).eventtype,'stopGoLeftFA'));
if idx;
RT_PreError_us(y) = eegdata.epoch(y).eventlatency{2};
RT_PreError_us(y)= nan;
Preerror_us(s) = (mean(RT_PreError_us, 'omitnan'));

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by