float valueSD(string question)
float valueSD(string question, string|array items)
float valueSD(array variables)
Calculates the standard deviation of the answer codes for all items in a question (e.g. a scale), for selected items, or for a list of variables.
Note: This works in the same way as valueSum()
– the parameters are described in this chapter in detail with various examples.
The following PHP code identifies participants who always selected the same value (straight-lining) in the scale “AB01”, and sends them to the end of the questionnaire immediately.
$sd = valueSD('AB01'); if ($sd == 0) { goToPage('end'); }
The following PHP code displays a message to participants who predominately chose the same value in the scale “AB02”.
$sd = valueSD('AB02'); if ($sd < 0.25) { text('think more'); }
Note: The standard deviation of a scale is not a valid indication of data quality in a questionnaire. 1). Only use the above examples with the utmost caution.