mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-11 03:30:54 +00:00
3.9 KiB
3.9 KiB
jspsych-survey-likert plugin
The survey-likert plugin displays a set of questions with Likert scale responses. The subject responds by selecting a radio button.
Parameters
Parameters with a default value of undefined must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description |
---|---|---|---|
questions | array | undefined | An array of objects, each object represents a question that appears on the screen. Each object contains a prompt, labels and required parameter that will be applied to the question. See examples below for further clarification.prompt : Type string, default value is undefined. The strings are the question that will be associated with a slider. labels : Type array, default value is undefined. Each array element is an array of strings. The innermost arrays contain a set of labels to display for an individual question. If you want to use blank responses and only label the end points or some subset of the options, just insert a blank string for the unlabeled responses.required : Type boolean, default value is false. Makes answering questions required. name : Name of the question. Used for storing data. If left undefined then default names (Q0 , Q1 , ... ) will be used for the questions. |
randomize_question_order | boolean | false |
If true, the display order of questions is randomly determined at the start of the trial. In the data object, Q0 will still refer to the first question in the array, regardless of where it was presented visually. |
preamble | string | empty string | HTML formatted string to display at the top of the page above all the questions. |
scale_width | numeric | null | The width of the likert scale in pixels. If left null , then the width of the scale will be equal to the width of the widest content on the page. |
button_label | string | 'Continue' | Label of the button. |
Data Generated
In addition to the default data collected by all plugins, this plugin collects the following data for each trial.
Name | Type | Value |
---|---|---|
responses | JSON string | A string in JSON format containing the response for each question. The encoded object will have a separate variable for the response to each question, with the first question in the trial being recorded in Q0 , the second in Q1 , and so on. The responses are recorded as integers, representing the position of the slider on the scale. If the name parameter is defined for the question, then the response will use the value of name as the key for the response in the responses object. |
rt | numeric | The response time in milliseconds for the subject to make a response. The time is measured from when the questions first appear on the screen until the subject's response. |
question_order | JSON string | A string in JSON format containing an array with the order of questions. For example [2,0,1] would indicate that the first question was trial.questions[2] (the third item in the questions parameter), the second question was trial.questions[0] , and the final question was trial.questions[1] . |
Examples
Basic example
var scale_1 = [
"Strongly Disagree",
"Disagree",
"Neutral",
"Agree",
"Strongly Agree"
];
var likert_page = {
type: 'survey-likert',
questions: [
{prompt: "I like vegetables.", labels: scale_1}
]
};
Multiple questions in a random order
var scale_1 = [
"Strongly Disagree",
"Disagree",
"Neutral",
"Agree",
"Strongly Agree"
];
var likert_page = {
type: 'survey-likert',
questions: [
{prompt: "I like vegetables.", name: 'Vegetables', labels: scale_1},
{prompt: "I like fruit.", name: 'Fruit', labels: scale_1},
{prompt: "I like meat.", name: 'Meat', labels: scale_1},
{prompt: "I like dairy.", name: 'Dairy', labels: scale_1}
],
randomize_question_order: true
};