Randomising serially presented text items within a trial

PennController for IBEX Forums Support Randomising serially presented text items within a trial

This topic contains 1 reply, has 2 voices, and was last updated by Jeremy Jeremy 3 weeks, 4 days ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #7193
    Avatar
    ari
    Participant

    Hi there!

    I’m super new to this so apologies if this is something really basic that I have somehow missed:

    Each trial of our experiment shows participants three sentences of contextual information, then poses a specific question, presents an answer to the question based on the aforementioned context, and finally asks participants if this answer is true or false.

    Essentially, I’m trying to shuffle the text items for the context within a trial. I managed this in a previous version of the experiment where all the text items were presented at once by using a disabled selector item. However, in the new version, we’re trying to make it a bit harder by showing one sentence at a time. The selector trick doesn’t work anymore; I could add them to a selector but then can’t get only one element within the selector to show on the screen at a time as far as I know….

    Is there a way to do this? Either to pull out single selector elements, or to randomize the order of elements that are presented serially within a trial? I suppose Sequence only works for trials, right?

    Here’s what the template for a trial looks like as it is now, without the premises randomized:
    (the weird canvases are a relic from the previous version, they just help buttons stay in the same place across screens)

    Template("fillers.csv", row =>
        newTrial("filler-trial",
        
            defaultText
                .center()
                .print(),
                
            newText("premise1", row.Premise_1),
            
            newButton("next", "NEXT"),
         
            newCanvas("singlebutton", 200, 250)
                .add(300, 100, getButton("next"))
                .print(),
        
            getButton('next')
                .wait(),
                
            clear(),
                
            newText("premise2", row.Premise_2),
            
            getCanvas('singlebutton')
                .print(),
         
            getButton('next')
                .wait(),
        
            clear(),
                
            newText("premise3", row.Premise_3),
    
            getCanvas('singlebutton')
                .print(),
         
            getButton('next')
                .wait(),
        
            clear(),            
            
            newText("question", row.Question)
                .log(),
            
            getCanvas('singlebutton')
                .print(),
         
            getButton('next')
                .wait(),
        
            clear(),
                
            newText("test", row.Test)
                .log(),
        
            newSelector("TF"), 
            
            newButton("true", "TRUE")
                .selector("TF"),
            
            newButton("false", "FALSE")
                .selector("TF"),
    
            newCanvas("TFcanvas", 200, 200)
                .add(200, 100, getButton("true") )
                .add(400, 100, getButton("false") )
                .print(),
    
            getSelector("TF")
                .log()
                .wait()
            )
            
        .log("item", row.item)
        .log("truthvalue", row.TVal)
        
    );
    

    And here’s a link to a stripped-down demo of some trials:
    https://farm.pcibex.net/r/WXIuYO/

    Thank you in advance for your input!

    • This topic was modified 3 weeks, 4 days ago by Avatar ari.
    #7195
    Jeremy
    Jeremy
    Keymaster

    Hi,

    The most efficient solution here is probably to use javascript to randomly determine which premises you’ll pick as the first, second and third ones. And since you don’t need to do it during runtime, you can randomize those things for each trial when generating them, in the function you pass to Template

    To give you an idea, you would start your Template command like this:

    Template("fillers.csv", row => {
        row.premiseIndices = [1,2,3];
        fisherYates(row.premiseIndices);
        return newTrial("filler-trial",
    

    You can find the full code (and its demo) here: https://farm.pcibex.net/r/WKBLfB/

    Jeremy

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

You must be logged in to reply to this topic.