Return to the Duration Discrimination Task page
Script Author: Katja Borchert, Ph.D. (firstname.lastname@example.org) for Millisecond Software, LLC
last updated: 11-05-2019 by K. Borchert (email@example.com) for Millisecond Software, LLC
Script Copyright © 11-05-2019 Millisecond Software
This script implements a Duration Discrimination procedure similarly to the one described in:
Wittmann, M., Leland, D.S., Jan Churan, J. & Paulus, M.P.(2007). Impaired time perception and motor timing
in stimulant-dependent subjects. Drug and Alcohol Dependence, 90, 183–192.
* Adaptive Maximum-Likelihood Based Algorithm YAAP:
Treutwein, B. (1997). YAAP: yet another adaptive procedure. Spatial Vision 11, 129–134.
* Accelerated Stochastic Approximation Procedure (ASA)
Faes, L., Ricci, L., Vescovi, M., Turatto, M., Pavani, F., & Antolini, R. (2007).
Small-sample characterization of stochastic approximation staircases in forced-choice adaptive
threshold estimation. Perception & Psychophysics, 69 (2), 254-262.
Note: based on the recommendation of Dr. Treutwein, this script does not implement the YAAP procedure
but rather uses the Accelerated Stochastic Approximation Procedure (Faes et al, 2007)
Millisecond Software thanks Dr. Treutwein for his generous assistance!
Participants listen to two tones (one a standard tone, the other the comparison tone) one after the other and
have to decide which is longer. In half the trials the standard is played first.
Two different standard tone lengths are used: 100ms (short) vs. 1000ms (long).
Within 50 trials (default; change under BLOCKS -> block.durationdiscrimination) the script attempts to estimate
the participants' threshold durations via an Accelerated Stochastic Approximation procedure
(see below for an explanation).
the default set-up of the script takes appr. 8 minutes to complete
DATA FILE INFORMATION
The default data stored in the data files are:
(1) Raw data file: 'durationdiscrimination_raw*.iqdat' (a separate file for each participant)
build: The specific Inquisit version used (the 'build') that was run
computer.platform: the platform the script was run on (win/mac/ios/android)
date, time, date and time script was run
subject, group, with the current subject/groupnumber
script.sessionid: with the current session id
blockcode, blocknum: the name and number of the current block (built-in Inquisit variable)
trialcode, trialnum: the name and number of the currently recorded trial (built-in Inquisit variable)
Note: trialnum is a built-in Inquisit variable; it counts all trials run; even those
that do not store data to the data file such as feedback trials. Thus, trialnum
may not reflect the number of main trials run per block.
values.condition: 1 = standard 1 trial sequence; 2 = standard 2 trial sequence
values.currtrialcount_standard1_n: counts the trials in standard 1 trial sequence
values.currtrialcount_standard2_n: counts the trials in standard 2 trial sequence
values.comptone_duration: stores the currently valid (depending on standard) current duration of the comparison tone in data file
values.stepsize: stores the currently valid stepsize (depending on standard) in the data file
values.nextcomptone_duration: stores the currently valid (depending on standard) next duration of the comparison tone in data file
values.curr_response: store the values for the current and the previous response accurracy for the currently tested tone condition
Response: the participant's response (scancode of response)
2 => participant pressed '1'
3 => participant pressed '2'
correct: the correctness of the response (1 = correct; 0 = incorrect)
latency: the response latency (in ms)
(2) Summary data file: 'durationdiscrimination_summary*.iqdat' (a separate file for each participant)
computer.platform: the platform the script was run on (win/mac/ios/android)
script.startdate: date script was run
script.starttime: time script was started
script.subjectid: assigned subject id number
script.groupid: assigned group id number
script.sessionid: assigned session id number
script.elapsedtime: time it took to run script (in ms); measured from onset to offset of script
script.completed: 0 = script was not completed (prematurely aborted);
1 = script was completed (all conditions run)
parameters.probability_p: target threshold probability (default: 0.75)
expressions.number_iterations: stores the number of trials used to determine threshold
parameters.standard1_duration: duration of standard 1 tone in ms (default: 100ms)
parameters.standard2_duration: duration of standard 2 tone in ms (default: 1000ms)
parameters.initialduration_comp1: initial duration for comparison 1 tone in ms (default: 300ms)
parameters.initialduration_comp2: initial duration for comparison 2 tone in ms (default: 3000ms)
parameters.initialcorrection_standard1_C: initial stepsize correction for standard 1 tone in ms (default: 100ms)
parameters.initialcorrection_standard2_C: initial stepsize correction for standard 2 tone in ms (default: 1000ms)
expressions.threshold1_duration: the calculated threshold duration for standard tone1 in ms (determined as values.nextcomptone1_duration)
expressions.threshold2_duration: the calculated threshold duration for standard tone2 in ms (determined as values.nextcomptone2_duration)
The Duration Discrimination procedure described (Wittman et al, 2007) used the adaptive maximum-likelihood based
algorithm YAAP (Treutwein, 1997) to vary the length of the next stimulus in order to find the
participant's threshold duration (threshold duration was defined as the duration at which a participant makes
correct choice with probability p = 0.75).
Based on Dr. Treutwein's own recommendation, this script uses the Accelerated Stochastic Approximation Procedure (ASA)
(e.g. Faes et al, 2007)instead.
Accelerated Stochastic Approximation (ASA) Procedure:
Stochastic Approximation Procedures (SA) belong to the category of non-parametric adaptive procedures to establish
sensory thresholds. Their goal is to determine the threshold intensity at which point participants make the correct choice
with probability p.
SAs are staircase procedures with variable steps that adjust the next stimulus intensity
(either up=increase or down=decrease stimulus intensity)
depending on whether response was correct or incorrect over the course of a set number of trials (N).
The adjustment of the stimulus intensity is inverse to the number of trials run, so adjustments
get smaller the more trials have been run.
stepsizecorrection_decrease = C * (1-p)/n (after correct response, n = number of trials run so far, C= initial step size correction)
stepsizecorrect_increase = (C*p) / n (after incorrect response, n = number of trials run so far, C= initial step size correction)
ASAs differ from the more basic SAs simply by not adjusting the step size after each response but only if a shift
in the response (from correct to incorrect or vice versa) occurs. In ASA procedures the stimulus intensities tested home in on the threshold intensity more rapidly
compared to the standard SA procedures.
According to Faes et al (2007), ASA work relatively well for 2-alternative forced-choice paradigms as long as
1. the initial stimulus intensity is above the participant's threshold
2. the procedure is started with a relatively large initial step size correction (C)
Furthermore, there will be a trade-off for ASA procedures between determining accurate thresholds (the more
trials are run the more accurate the threshold) and the length of the assessment (the more trials
are run the longer the experiment). The threshold itself can be estimated using two alternative ways:
1. the threshold is the duration that would have been chosen next had the procedure not terminated (used in this
2. the average of the last M trials
In this script: 50 trials per standard tone (=> 100 trials total)
see section Editable Stimuli
instructions are not original and can be easily edited under section Editable Instructions
check below for (relatively) easily editable parameters, stimuli, instructions etc.
Keep in mind that you can use this script as a template and therefore always "mess" with the entire code
to further customize your experiment.
The parameters you can change are:
/standard1_duration: duration of standard 1 tone in ms (default: 100ms)
/standard2_duration: duration of standard 2 tone in ms (default: 1000ms)
/initialduration_comp1: initial duration for comparison 1 tone in ms (default: 300ms)
/initialduration_comp2: initial duration for comparison 2 tone in ms (default: 3000ms)
/comp1_min: minimum duration of comparison 1 tone in ms (default: 101ms)
/comp2_min: minimum duration of comparison 2 tone in ms (default: 1005ms)
/initialcorrection_standard1_C: initial stepsize correction for standard 1 tone in ms (default: 100ms)
/initialcorrection_standard2_C: initial stepsize correction for standard 2 tone in ms (default: 1000ms)
/probability_p: target threshold probability (default: 0.75)
/InterstimulusInterval: pause between the two tones in ms (default: 500ms)
/Intertrialinterval: pause between trial sequences in ms (default: 1000ms)