# jspsych-nafc-adaptive This is not a jsPsych plugin, but instead a module that generates a timeline for adaptive tracking of a threshold using an odd-one-out task (nAFC). An adaptive method is a method where each new set of stimuli in a trial is based on the previous response(s). [Levitt (1971)](https://doi.org/10.1121/1.1912375) has described these methods for auditory stimuli. In the case of a discrimination task, the difference between a reference and test stimuli decreases progressively to reach a certain point of the psychometric function. Rules to go up and down, i.e. increase or decrease the physical distance between the reference and test are described in number of 'up' and 'down'. For instance, "2-down, 1-up" means that the difference is decreased by a given step when two consecutive correct answers are given, while the difference is increased as soon as one mistake is made. This yields a threshold corresponding to 70.7%-correct. Adaptive procedures are meant to be a faster alternative to a *constant-stimuli* method. The threshold is defined as the average difference over a number of "turn-points" or "reversals". A turn-point occurs when a the difference was increasing and start decreasing, or vice-versa. The procedure also stops after a number of turn-points. Some adaptive procedures use a fixed step size. These generally end-up being almost as long as constant-stimuli approaches. To benefit from the adaptiveness of the method, it is better to use an initial step that is large, and then refine it when we get close to threshold. The method proposed here packs mechanisms to do so. A progress bar is shown per run. The progress is updated using the number of turn-points. ## Usage To use it you'll need the following jsPsych dependencies included in your webpage (after adapting the path to wherever your Javascript files are): ```html ``` * `jspsych-audio-sequence-button-response.js` can be found [here](../plugins/jspsych-audio-sequence-button-response.js). * `jspsych-waitfor-response.js` can be found [here](../plugins/jspsych-waitfor-response.js). * `tools.js` can be found [here](../../js/tools.js). `tools.js` defines new functions to `Array.prototype` to help some calculations of the threshold. The module defines a single function called `nAFC_adapt` that generates a timeline. It is then used like this in a `