logtrial in practice Demo Experiment Run Experiment

logtrial in practice

Jaap Murre

Demo how to use the logtrial() function in a typical reaction time experiment.


The logtrial() function works well with the datadashboard (speedometer icon). In addition to logging just a value and a variable name, as you do with log(), you can also log the conditions.

In this example, there is one condition: Yes and No, where one has to click anywhere on text(‘Yes’) and do nothing with text(‘No’), which will lead to a timeout. In the example, we log this with:

    logtrial(e.RT,“RT”,stimuli,e.type)

where stimuli is either ‘Yes’ or ‘No’ (assigned by you) and e.type is either ‘click’ (an event) or ‘timeout’ (subject did not click).  

In the datadashboard, you will see the data neatly sorted according to the two conditions. These are called Con1 and Con2 (these labels cannot be changed), as follows:


IndexSubjectCon1Con2RT
162416
262419
362419yesclick1219.0200000040932
462419noclick543.8149999972666
562419notimeout1999.9499999976251
662419yesclick739.7249999994528
762419noclick1060.1049999968382
862419yestimeout1998.8549999980023

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.

var stimuli = ["yes","no","no","yes","no","yes"];

var i,e;

instruction("Click only if you see 'Yes'");
await(2000);

for (i = 0; i < stimuli.length; i++) {
    text(stimuli[i]);
    e = await("click",2000);
    
    logtrial(e.RT,"RT",stimuli[i],e.type);
//    logtrial(1,"Accuracy",stimuli[i],e.type);
    
    await(1000);
    clear();
    await(1000);
}

text("Thank you!");
await(2000);
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