Data collection basics

Collecting data

PennController automatically logs when a trial starts and when it ends, but you have to explicitly tell it what other information you want to collect. In our case, we are interested in what is captured by the key element. PennController has a command that logs element-related events: .settings.log. All we need to do in order to see a line reporting key presses appear in our results file is use this command within the newKey block, like this:

PennController(
    newText("The fish swim in a tank which is perfectly round")
        .print()
    ,
    newImage("two", "2fishRoundTank.png")
        .settings.size(200,200)
    ,
    newImage("one", "1fishSquareTank.png")
        .settings.size(200,200)
    ,
    newCanvas(450,200)
        .settings.add(   0 , 0 , getImage("two") )
        .settings.add( 250 , 0 , getImage("one") )
        .print()
    ,
    newKey("FJ")
        .settings.log()
        .wait()
)

Inspecting the results file

To look at the results do the following:

  1. Save and Close the main.js file.
  2. Delete any existing results files on your main experiment project page.
  3. Do a full run-through of the experiment to collect data.

After this, you should see two files under Results on the main page of your project. (If you can’t see them, try clicking the refresh icon next to Results.) We will work with the file results, which is a comma-separated-value (CSV) file. Click on results to see its content.

The first thing to note is that lines starting with # are comments providing information on how and when the data was collected, and on what the values separated by commas in the lines below represent. You don’t have to spend time on these for now.

For each time that you’ve taken the experiment, you will now see 3 lines. The first and the last are the beginning and end of the trial with timestamp information; these are recorded for any PennController trial and say Start and End in one of the columns towards the right end.

In addition, there is a line containing the value Key between the Start and the End lines. Here, the third value from the end, next to KeyPressed, indicates the key that was pressed.
The next value (second from the end) is the timestamp of this event. Subtract it from the timestamp of the Start line to get the response time. When you have multiple trials, you can use this method to compare response times in different conditions, e.g., for trials with and without an -s on the verb in our example experiment.

This was a first quick introduction to the results file. As you collect more data, you will want to automatize the analysis process, which is documented later on in the tutorial. For now, let us see how to add another crucial piece of information to our results file, which adds an identifier for the participant to each line of the results.


Next: Participant information.