teg_calc_D600

Calcuate the D600 score for IAT data. The inputs are three vectors containing, respectively, the block (1 to 7), reaction time, and accuracy per trial. The 1 to 7 block coding is target (congruent mapping) practice, attribute practice, mixed (congruent) practice, mixed (congruent) testing, target (incongruent mapping) practice, mixed (incongruent) practice, and mixed (incongruent) testing.

function D600 = teg_calc_D600(cond, rt, acc)

% Reject subject if too many fast guesses
f = find(rt < 300);
if length(f) / length(rt) > 0.1,
    D600 = NaN;
    return;
end;

% Remove trials with RT over 10 s
f = find(rt > 10000);
cond(f, :) = [];
rt(f, :) = [];
acc(f, :) = [];

% Remove trials after errors
f_error = find(acc(1:(end - 1)) == 0 );
f_after_error = f_error + 1;
cond(f_after_error, :) = [];
rt(f_after_error, :) = [];
acc(f_after_error, :) = [];

% Replace RTs on error trials
f_error = find(acc == 0);
f_correct = find(acc == 1);
for iBT = 1:7,
    f = find(cond(f_correct) == iBT);
    m = mean(rt(f_correct(f)));
    f = find(cond(f_error) == iBT);
    rt(f_error(f)) = m + 600;
end;

% Calculate D600 components
f = find(cond == 3 | cond == 6);
practSD = sqrt(var(rt(f)));
f = find(cond == 4 | cond == 7);
critSD = sqrt(var(rt(f)));
m3467 = [];
for iBT = [3 4 6 7],
    f = find(cond == iBT);
    m = mean(rt(f));
    m3467 = [m3467 m];
end;
d63 = m3467(3) - m3467(1);
d74 = m3467(4) - m3467(2);
n63 = d63 / practSD;
n74 = d74 / critSD;

% Determine D600 from final components
D600 = mean([n63; n74]);