This article applies to:
This sample demonstrates the use of the ArraySort and RandomizeArray commands to sort numerical subject ratings and perform a tiebreaking procedure (if necessary) for repeat presentation of stimuli that the subject prefers.
The ArraySort method is useful for sorting elements of an array from smallest to largest for numerical elements, or in alphabetical order for string elements. However, ArraySort is only compatible with single-dimension arrays. ArraySort is not compatible with arrays that have multiple dimensions or are of a user-defined data type, which are useful for organizing related data items of various types, see SCRIPTING: User-Defined Data Types . This poses a challenge for researchers who want to have subjects rate stimuli on a numerical scale, actively fill an array with a subject's numerical response values, and then determine a ranking of subject's preferences for the stimuli. For more information on arrays see SCRIPTING: Arrays .
This sample uses multiple arrays to demonstrate a design where subjects rate stimuli, then see a repeat presentation of stimuli of their preference. This sample presents twenty stimuli total, then repeats presentation of the subject's top ten stimuli. The various elements of the design that dictate the number of stimuli for initial and repeat presentation can all scale accordingly to meet the exact needs of your study.
NOTE: the E-Prime 2.0 version of this sample takes keyboard input while the E-Prime 3.0 version collects responses on a SlideSlider. The E-Prime 3.0 version uses a "Next" Button to lock in a final response and follows the Script Task Events method in Enabling a SlideButton based on SlideChoice/Slider response . If you prefer to use keyboard input in E-Prime 3.0, you can open the .es2 in E-Studio 3 instead and convert it to an .es3.
The initial and repeat presentation of stimuli are in Random order. The initial presentation can easily be Sequential instead, but to create a sequential repeat presentation around the full ranking (where initial presentation order does not have any undue influence when stimuli receive identical ratings), additional scripting is necessary. This sample also demonstrates the use of the RandomizeArray method for a tiebreaking procedure, which can be of use in this case.
This sample uses four separate arrays in total. A fixed array of a user-defined type holds both stimuli and each respective stimulus' numerical subject rating. Another fixed array holds the same ratings, but is a single-dimension array that is compatible with ArraySort. Subject responses and the current trial's stimuli actively populate these arrays during the course of each trial. The sample uses the ArraySort method on the latter array to determine a bottom half vs. top half cut-off score. The sample then compares the rating for each element of the former array against this cut-off score to determine if each stimulus' rating falls into the category of: 1. above, 2. below or 3. equal to the cut-off score.
Stimuli with ratings above the cut-off score automatically go into a separate dynamic array for repeat presentation. Stimuli with ratings equal to the cut-off score go into a different dynamic array. The sample uses the RandomizeArray method on this second dynamic array so that each stimulus with a rating identical to the cut-off score has an equal chance of repeat presentation, regardless of the initial order of presentation.
NOTE: This experiment contains many Debug.Print statements for demonstrative purposes and to assist with natural points of confusion when you go to adapt this experiment to your exact specifications. After you test and verify your changes, comment out the Debug.Print statements since their collective executions can accumulate to be a significant amount of time.