including attention checks and break

PennController for IBEX Forums Support including attention checks and break

This topic contains 5 replies, has 3 voices, and was last updated by Jeremy Jeremy 1 week, 5 days ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #5973
    Avatar
    kathy
    Participant

    Hi Jeremy,

    I have an experiment with 160 trial items (to be rated on a scale). I have currently included a break after half of the items (80) using the subsequence function / code: subsequence(repeat(randomize(“ListeW”), 80) , “break”).

    However, I would also like to include two attention checks (asking participants to choose a specific number on the scale), one in each half of the experiment. So one attention check should come after 40 items, and the other one after 120. Is there a way to code this without having to divide my .csv file and uploading two separate ones?

    The code for the attention check will be this:

    //////ATTENTIONCHECK
    PennController(“attentionCheck”,
    newText(“attentionCheck”, “Bitte wählen Sie auf der untenstehenden Skala fünfunddreißig aus!”)
    .settings.center()
    .settings.bold()
    .settings.css(“font-size”, “30px”)
    .print()

    ,

    newScale(“slider”,”0″, “1”,”2″,”3″,”4″,”5″,”6″,”7″,”8″,”9″, “10”,”11″,”12″,”13″,”14″,”15″,”16″,”17″,”18″,”19″,”20″,”21″,”22″,”23″,”24″,”25″,”26″,”27″,”28″,”29″,”30″,”31″,”32″,”33″,”34″,”35″,”36″,”37″,”38″,”39″,”40″,”41″,”42″,”43″,”44″,”45″,”46″,”47″,”48″,”49″, “50”)
    .settings.center()
    .settings.size (1200)
    .settings.labelsPosition(“bottom”)
    .print()
    .settings.log()
    .wait()
    ,
    newButton(“okay”, “weiter”)
    .settings.center()
    .print()
    .wait()
    .remove()
    ,

    getText(“attentionCheck”)
    .remove()
    ,
    getScale(“slider”)
    .remove()

    );

    Thank you very much in advance!

    Best,
    Kathy

    #5976
    Jeremy
    Jeremy
    Keymaster

    Hi Kathy,

    EDIT: Oops, looks like I misremembered how the subsequence function works. See message below for an alternative solution

    Since you’re already using the subsequence function, why don’t you just tell it exactly that? Here’s what your whole Sequence command could look like:

    Sequence( 
      "intro" 
      ,
      subsequence( 
          repeat(randomize("ListeW"), 40) , "attentionCheck"
          ,
          repeat(randomize("ListeW"), 40) , "break"
          ,
          repeat(randomize("ListeW"), 40) , "attentionCheck"
          ,
          repeat(randomize("ListeW"), 40)
      )
      ,
      "end"
    )

    I see that you named your Scale element “slider,” if you want to make it a “real” slider, you could consider using the slider command, like this:

    newScale("slider", 50)
      .before( newText("0 ") )
      .after( newText(" 50") )
      .slider()
      .print()
      .log()
      .wait()

    In any case, you don’t need to manually specify all 50 labels, you can just do this:

    newScale("slider", 50).labelsPosition("bottom")

    Jeremy

    • This reply was modified 6 months, 3 weeks ago by Jeremy Jeremy. Reason: Mistake
    • This reply was modified 6 months, 3 weeks ago by Jeremy Jeremy. Reason: Solution in next message
    #5980
    Jeremy
    Jeremy
    Keymaster

    So I came up with a new function that I think is better suited to your needs: it simply picks a number of trials from a set, so in your case you can pick 40 trials from the randomized set of all the trials labeled ListeW (randomize("ListeW")), and then pick 40 other trials from that same set. The trick here is that you’ll store the set in a variable, so you can reference it when you call pick again, instead of recreating a brand new set with randomize("ListeW").

    Define the pick/Pick functions the way you defined subsequence:

    function Pick(set,n) {
        assert(set instanceof Object, "First argument of pick cannot be a plain string" );
        n = Number(n);
        if (isNaN(n) || n<0) n = 0;
        this.args = [set];
        set.remainingSet = null;
        this.run = function(arrays){
            if (set.remainingSet===null) set.remainingSet = arrays[0];
            const newArray = [];
            for (let i = 0; i < n && set.remainingSet.length; i++)
                newArray.push( set.remainingSet.shift() );
            return newArray;
        }
    }
    function pick(set, n) { return new Pick(set,n); } 

    Then you can use it like this:

    Sequence( 
        "intro",
        pick(liste=randomize("ListeW"),40),"attentionCheck",
        pick(liste,40),"break",
        pick(liste,40),"attentionCheck",
        pick(liste,40),  
        "end"
    )

    As you can see I generate a randomized set of trials in the first pick function, and I store it in a javascript variable named liste, so I can reference it in the next three pick's. You could actually even create the set above the Sequence command and only reference it using the variable in all the pick functions. You just want to always use a unique javascript variable name (liste is not ideal because the generic English word list is likely to be used elsewhere, but hopefully the final e will help avoid any conflicts).

    Let me know if you have questions

    Jeremy

    #5989
    Avatar
    kathy
    Participant

    Dear Jeremy,

    thanks a lot! I tried the first thing you suggested and as you said below, that doesn’t seem to be the right function for me as I realized that items will be shown repeatedly after the break or attention checks, which is not what I wanted – I’d like to have different (randomized) items from the same set in each section so that every item will have been rated only once per participant, as you said in your second reply. I’ll try out the second solution you suggested tomorrow and will probably get back to you once I encounter difficulties. Thank you so much in any case!

    Kathy

    #6645
    Avatar
    rhododendron
    Participant

    Hi Jeremy,

    I have been trying to use the pick function in my experiment to implement breaks as well. The problem is that I am using a csv file for the experimental trials, which have already been pseudo-randomized and thus I want to avoid using the function randomize() on the javascript list variable. I tried defining some sort of dummy string function to return the input strings and leave them unchanged. However, this does not seem to work.
    Is there any possibility to use pick without randomization or is it just easier to use separate csv files and just include breaks in between?

    Thank you!

    #6646
    Jeremy
    Jeremy
    Keymaster

    Hi,

    Simply replace randomize with seq and it should be enough

    Jeremy

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.