My 6th Script: Advanced Words Demo Experiment Run Experiment

My 6th Script: Advanced Words


This is a complex word recall experiment, with two conditions and personalized feedback.

My 6th Script gives our word recall task a more complex design. It tests whether processing words more deeply leads subjects to remember them better, using a 2-condition, within-subjects design.

First, the subject is told to remember the following words, and also instructed to notice whether they’re written in upper- or lower-case. This elicits structural (shallow) processing. They write the words they remember. Again, the subject is told to remember the following words, but this time is instructed to think about the meaning of the word. This elicits semantic (deep) processing. Again, they write the words they remember. After these two trials, a short text explains the purpose of the experiment, and the subject is shown their score for both conditions.

This script also introduces how to write and use your own functions. First, we demonstrate the concept of putting some script inside a function by putting the for-loop from My 4th Script inside one. Then, we provide the script for and employ another handy function that automatically grades the subject’s answers. It compares the words they type to the original word list and produces a score of how many words they got correct.

Topics introduced: writing functions, multiple conditions, within-subjects design, log(), giving feedback by showing a variable within text.

If you are a registered user and signed in, you can here copy this script and its stimuli to your own account, where you can edit it and change it in any way you want.

It is absolutely free to register (no credit card info asked!). You can then instantly copy this experiment with one click and edit it, change its accompanying texts, its landing page, stimuli, etc. Invite your colleagues, friends, or students to check out your experiment. There is no limit on how many people can do your experiment, even with a free account.

The catch? There is no catch! Just keep in mind that with a free account, you cannot collect data. For teaching that is usually not a problem. For research, prepaid data collection (unlimited subjects) starts as low as €10.00 for a 10-day period.

/* We write our own functions in this experiment. Writing a function is a handy  
way to shorten the body of your script by putting repetitive parts out of the
way, inside a function. We recommend keeping all your functions at the top. Then, 
when writing the body of your script, you can just refer back to the function 
whenever you need to do those repetitive steps, instead of writing them all out. 
Whatever you put as the argument when referring back to the function will be 
substituted in wherever the original function mentions its argument. This way, 
functions can be written out once, but applied to many different things.*/

// WORD LOOP FUNCTION: The "for-loop" from My 4th Script, put inside a function
// When we call "showmywords" in lines 53 and 64, it will do this for-loop
function showmywords(vocab)
    for (i = 0; i < vocab.length; i = i + 1)

// AUTO-SCORE FUNCTION: counts how many words a subject remembered correctly
// Ignore the contents; this function is very complex. Just enjoy that it works!
function autoscorewords(answerkey, subjectsanswer, criterion)
    var correct = 0;
    criterion = criterion || 0.25; // typos up to 25% different are counted as correct (e.g., parc instead of park, walsh instead of wash)
    r = subjectsanswer.split(/[^A-Za-z]+/);
    for(j = 0; j < answerkey.length; j = j + 1)
        for(k = 0; k < r.length; k = k + 1)
            if(distance(answerkey[j].toLowerCase(),r[k].toLowerCase()) <= criterion*answerkey[j].length) {
                correct = correct + 1;
    return correct;

// Now, the body of the experiment:

// 2 separate word lists (one for each condition)
var shallow = ["bowl","APPLE","tent","glasses","cat","ROUND","TREE","work","SMOKE","SHEEP"];
var deep = ["cake","bird","slow","lake","green","chair","wash","bike","queen","light"];

instruction("This memory experiment has 2 trials. In both trials, you'll be shown 10 words, then asked to write the words you remember.");

instruction("Trial 1: Try to remember the following words. To help you remember them, notice whether they're written in upper or lowercase.");
    // ^ Plugs shallow into showmywords wherever it says vocab
var shallow_typed = largeinput("Type the words you remember.","shallow_recalled"); 
    // ^ Stores the subject's answer in a variable called "shallow_typed" so that it can be accessed/used later in the script (e.g., in the next line!)
var shallow_returned = autoscorewords(shallow, shallow_typed); 
    // ^ Plugs the newly-stored answer into autoscorewords, and stores the returned score in variable called shallow_returned
log(shallow_returned, "shallow_score");
    //^ Saves the subject's score (shallow_returned) as a new line in your data, under the label shallow_score

instruction("Trial 2: Again, try to remember the following words. This time, to help you remember them, think about what the word means, or how you would describe it to someone.");
var deep_typed = largeinput("Type the words you remember.","deep_recalled");
var deep_returned = autoscorewords(deep, deep_typed);
log(deep_returned, "deep_score");

text("Trials are now over. This experiment looked at levels of processing, and the theory that people remember things better the more deeply they process them. Noticing upper vs. lowercase was structual (shallow) processing. Thinking about meaning was semantic (deep) processing.<p>Press space to finish.</p>");
text("You remembered " + shallow_returned + " shallowly-processed words and " + deep_returned + " deeply-processed words.");
text("The experiment is now over. Thank you!");

You can download the files as follows: Click on the file (link) and then right-click and choose Save as... from the menu. Some media files (e.g., sound) will have a download button for this purpose.

This experiment has no files of this type
This experiment has no files of this type
This experiment has no files of this type
This experiment has no YouTube links
This experiment has no files of this type