Logging of wording of Comprehension Question

PennController for IBEX Forums Support Logging of wording of Comprehension Question

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #7690
    Silke
    Participant

    First the link to the project: https://farm.pcibex.net/r/GgGqjs/

    I am using the old Ibexfarm controllers Dashed Sentence and Question for a self-paced reading experiment in which every sentence is followed by a comprehension question. I made a template for the trial, in which the sentence is read from a csv file (cost me a good day to realize that is HAS to be a comma as a delimiter and nothing else like the semicolon that is the default when I derive a csv file from an xls file) and the question is read from the same file. I also managed to program an accuracy check. That all works very nicely.

    Now, when I look into the results, it gives me reading times for each word (hooray!) and also lists the word itself, just like in the old Ibexfarm. It also appends the expected answer and the accuracy check to every line for the reading time. What I am missing and what was present in my old results files is a log of the comprehension question itself and the reaction time. The answer key press has its own row with a timestamp, but as the question itself is not logged, I cannot calculate reaction time from it.

    Here’s the code:

    Template("items.csv", row =>
        newTrial("experiment",
            newTimer("break", 1000)
            .start()
            .wait()
            ,
            newController("DashedSentence", {s:row.sentence})
            .print()
            .log()
            .wait()
            .remove()
            ,
            newController("Question", {q: row.question, as: ["Ja", "Nein"]})
            .print()
            .log()
            ,
            newKey("answer", "JN")
            .log()
            .wait()
            ,
            getKey("answer")
            .test.pressed(row.answer)
            .success(getVar("isCorrect").set(1))
            .failure(getVar("isCorrect").set(0))
        )
        .log("group", row.group) 
        .log("item", row.item)
        .log("condition", row.condition)
        .log("accurate_answer", row.answer)
        .log("isCorrect", getVar("isCorrect"))    
    )

    The reaction time data is not that important, but I somehow didn’t manage to include a timeout of 5000ms for the question as any code I tried would either lead to the question not getting displayed or the keypress being ignored. So being able to log the time from question display to keypress would help to eliminate very slow responses.

    So, suggestions for either solution are very welcome: either logging the comprehension question or creating the timeout.

    Thanks a lot in advance,

    Silke

    #7691
    Jeremy
    Keymaster

    Hello Silke,

    Including the Question controller as you do in the code you shared but validating the trial by waiting for a Key element will only use the controller to show the question, but unless the participant makes the effort of clicking on one of the two answers (which won’t have any visible effect on their part) then the Question controller won’t detect any answer as far as it is concerned: only the Key element will detect that something happened. This is why you won’t see a line in the results file for the Question controller (unless you click on an answer)

    If you’d like to stick to the original Ibex controller, you could do that instead, using the options described in the Ibex manual:

    Template("items.csv", row =>
        newTrial("experiment",
            newTimer("break", 1000)
                .start()
                .wait()
            ,
            newController("DashedSentence", {s:row.sentence})
                .print()
                .log()
                .wait()
                .remove()
            ,
            newController("Question", {
                q: row.question,
                as: ["Ja", "Nein"],
                autoFirstChar:true,
                hasCorrect:row.answer,
                randomOrder:false
            })
                .print()
                .log()
                .wait()
        )
        .log("group", row.group) 
        .log("item", row.item)
        .log("condition", row.condition)
        .log("accurate_answer", row.answer)
    )

    You’d need to use “Ja” and “Nein” in your answer column so that that cell matches one of the two possible answers, and you’ll get a 0 or 1 in the tenth column (IIRC) indicating whether the answer was correct

    Another option would be to get rid of the Question controller altogether, in which case it would be easier to implement a timeout feature:

    Template("items.csv", row =>
        newTrial("experiment",
            newTimer("break", 1000)
                .start()
                .wait()
            ,
            newController("DashedSentence", {s:row.sentence})
                .print()
                .log()
                .wait()
                .remove()
            ,
            newText("Question", row.question).center().print()
            ,
            newText("<p>1. Ja<br>2. Nein</>>").center().print()
            ,
            newKey("Answer", "JN")
                .once()
                .callback( getTimer("delay").stop() )
                .log("last")
            ,
            newTimer("delay", 5000).start().wait()
            ,
            newVar("isCorrect").global()
            ,
            getKey("Answer")
                .test.pressed( row.answer )
                .success( getVar("isCorrect").set(1) )
                .failure( getVar("isCorrect").set(0) )
        )
        .log("group", row.group) 
        .log("item", row.item)
        .log("condition", row.condition)
        .log("question",row.question)
        .log("accurate_answer", row.answer)
        .log("correct", getVar("isCorrect"))
    )

    Note that because this tests the key that was pressed, and not which answer was chosen, row.answer should either be J or N, just like it currently is in your csv file

    I’m sorry you experienced issues when exporting the xls file to a csv file. I wasn’t aware that Excel used semi-colons as a default separator in that operation: csv stands from comma-separated values, and semi-colons are not a standard when it comes to those types of files–tabs are another common separator, which have a dedicated tsv extension but are sometimes also found in place of csv files (PennController will accept tsv files too)

    Jeremy

    #7693
    Silke
    Participant

    Thanks a lot, Jeremy!
    Both options look really neat and now I have to decide which one I like better. 🙂

    The issue with the csv file was to find out that it was the actual formatting that caused the error and not something in my code. I got suspicious after a while, when I remembered that when I read my csv files into R, I have to change the delimiter setting as well. After some researching, it turns out that Germany (and probably some other European countries as well) uses the comma to indicate the decimal, so the Windows setting for the default separator is the semicolon. Small difference, big huuuuh???

    So, good to know that tsv files are also accepted by PennController.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.