Randomising serially presented text items within a trial

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

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #7193
    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 years, 3 months ago by ari.
    #7195
    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

    #7772
    ari
    Participant

    Hi Jeremy,

    It’s been a while but I’ve just gotten back to this – I tried your solution and it works perfectly.

    Many thanks for the extremely helpful answers!!

    Best regards,
    Ari

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