2.2.0 • Published 5 months ago

jspsych-attention-check v2.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

jspsych-attention-check

A jsPsych plugin for creating attention-check questions.

Note: This package is NOT compatible with jsPsych versions >= 7.0.

npm npm

To install this package compatible with jsPsych v6.3 or earlier:

$ npm install jspsych-attention-check@2.2.0

or,

$ yarn add jspsych-attention-check@2.2.0

!WARNING Version 2.2.0 introduces breaking changes to the jsPsych parameters. Review the Parameters section carefully!

Overview

This plugin allows two styles of attention-check questions to be displayed, while supporting keyboard input schemes for the radio button display style. Additional features include an input timeout, rich feedback capabilities, and the ability to ask the participant for confirmation before submitting their response.

The plugin makes use of React and the Grommet UI library, an accessibility-first library that provides a number of useful components. Given that jsPsych experiments may not use React, the plugin will clean up after itself to ensure there are no issues mixing a React-based component with a non-React experiment.

Parameters

NameTypeRequired?DescriptionExample
promptstringYesThe prompt to be presented to the participant.
styleradio or defaultNo (default: default)Change the display style of the responses. radio displays the responses as a set of radio buttons, and is the only display format supporting keyboard input configuration. default displays the options as a drop-down list.
responsesstring[]YesA list of responses that will be presented to the participant for them to select from.["Response A", "Response B", "Response C"]
feedback{ correct: string, incorrect: string }YesSpecify feedback to be presented depending on a correct or incorrect answer.{correct: "Correct feedback.", incorrect: "Incorrect feedback."}
input_timeoutnumberNo (default: 0)Specify an input timeout that must expire before a participant is permitted to interact with the attention-check question.1000
input_schema{ select: string \| null, next: string \| null, previous: string \| null }YesSpecify the input schema for using the keyboard to interact with the responses. Set each item to a string representation of a keyboard key to enable keyboard input, or leave all as null to disable keyboard input.{ select: "3", next: "2", previous: "1" }
confirm_continuebooleanYesOptionally display a confirmation message before submitting a selected response.{confirm: true, key: " "}

Data

Three data points are collected: attentionRT, attentionSelected, attentionCorrect:

  • attentionRT (number): a float representing the time taken by the participant to select an option once input is permitted. Measured in milliseconds.
  • attentionSelected (string): a string containing the value of the response selected by the participant.
  • attentionCorrect (boolean): a boolean representing the correctness of the participant's response.

Example Usage

You can add an attention-check to your jsPsych timeline like any other timeline node. The following example displays responses as a radio button group, and uses keyboard input only.

timeline.push({
  type: "attention-check",
  prompt:
    "In this task, who will be choosing the points you and your partner get?",
  style: "radio",
  responses: ["A lottery", "Me", "My partner"],
  correct: 1,
  feedback: {
    correct: "Correct!",
    incorrect: "Incorrect!",
  },
  input_timeout: 2000,
  input_schema: {
    select: "3",
    next: "2",
    previous: "1",
  },
  confirm_continue: true,
});

The following example displays responses as a drop-down, does not use keyboard input, and does not require confirmation.

timeline.push({
  type: "attention-check",
  prompt:
    "In this task, who will be choosing the points you and your partner get?",
  style: "default",
  responses: ["A lottery", "Me", "My partner"],
  correct: 1,
  feedback: {
    correct: "Correct!",
    incorrect: "Incorrect!",
  },
  input_timeout: 2000,
  input_schema: {
    select: null,
    next: null,
    previous: null,
  },
  confirm_continue: false,
});
2.1.2

5 months ago

2.2.0

5 months ago

2.1.3

5 months ago

3.1.1

5 months ago

3.0.0

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.7

3 years ago

2.0.6

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.6.0

3 years ago

1.4.2

3 years ago

1.5.0

3 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago