Unable to randomize fillers and experimental items

PennController for IBEX Forums Support Unable to randomize fillers and experimental items

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #8138
    yasufmg
    Participant

    Hi!

    I’m running a .csv file with the following conditions:

    ITEM,SENTENCE,COMPATIBILITY,SUBJECT,LIST,TYPE
    101,Sentence 1,1,subject1,A,item
    201,Sentence 2,1,subject1,B,item
    102,Sentence 3,2,subject2,B,item
    202,Sentence 4,2,subject2,A,item
    501,Filler 1,.,.,.,filler
    502,Filler 2,.,.,.,filler
    503,Filler 3,.,.,.,filler

    Unfortunately, every time I run the experiment, the filler sentences appear as another list. I’d like them to be showed as fillers on lists A and B instead, as I’ll be using the same fillers for both of them. Is there a way to solve this?

    Thanks in advance. Take care!

    #8139
    Jeremy
    Keymaster

    Hi,

    The experiment runs the fillers as a separate list because your table has three different values in the LIST column: A, B and .

    What I would do is store the function you pass to Template in a variable, create two different CSV tables for the experimental items (with a LIST column) and for the filler items (without a LIST column) and then use Template twice, once on each CSV table

    experimental.csv:

    ITEM,SENTENCE,COMPATIBILITY,SUBJECT,LIST,TYPE
    101,Sentence 1,1,subject1,A,item
    201,Sentence 2,1,subject1,B,item
    102,Sentence 3,2,subject2,B,item
    202,Sentence 4,2,subject2,A,item

    fillers.csv:

    ITEM,SENTENCE,COMPATIBILITY,SUBJECT,TYPE
    501,Filler 1,.,.,filler
    502,Filler 2,.,.,filler
    503,Filler 3,.,.,filler

    Example of a script:

    function_for_template = row => newTrial( row.TYPE ,
      newText( row.SENTENCE ).print()
      ,
      newScale("answer", "True", "False").button().print().log().wait()
    )
    .log("item", row.ITEM)
    .log("compatibility", row.COMPATIBILITY)
    .log("subject", row.SUBJECT)
    .log("list", (row.LIST===undefined?"filler":row.LIST))
    
    Template("experimental.csv", function_for_template)
    Template("fillers.csv", function_for_template)

    Jeremy

    #8207
    yasufmg
    Participant

    Hi, Jeremy! Thanks for the help. It worked!

    I’ve encountered another problem, though. I’m currently using a slider scale in my experiment, from 0 to 100. I’d like to add numbers labels below it so participants can know which value they’re choosing. Is there a way to do that?

    Thanks!

    Yasmin.

    #8208
    Jeremy
    Keymaster

    Hi Yasmin,

    It depends how exactly you mean to add labels, but one option would be to do this:

    newTrial(
      newText(`<span style='width: 2em; text-align: left;'>0</span>
               <span style='width: 2em; text-align: center;'>25</span>
               <span style='width: 2em; text-align: center;'>50</span>
               <span style='width: 2em; text-align: center;'>75</span>
               <span style='width: 2em; text-align: right;'>100</span>`)
        .css({display: 'flex', 'justify-content': 'space-between', width: '20em'})
        .print()
      ,
      newScale("answer", 100)
        .slider()
        .css({'max-width':'unset', width: '20em'})
        .print()
        .log()
        .wait()
    )

    Note that using CSS rules in the code like that is not ideal, so you might want to consider adding rules to the project’s CSS files instead

    Jeremy

    #8219
    yasufmg
    Participant

    Hi, Jeremy!

    This is exactly what I’m looking for! Thank you so much!

    One more thing: is there a way to align the numbers and the scale?

    This is my code:

    Template("experiment.csv", row =>
        newTrial( "experiment-"+row.TYPE,
            newText("sentence", row.SENTENCE)
                .cssContainer({"margin-top":"2em", "margin-bottom":"2em"})
                .center()
                .print()
                ,
                
        // 7-point scale
    
        newScale("slider", 100)
            .before( newText("left", "<div class='fancy'> TOTALMENTE INACEITÁVEL (0) </div>") )
            .after( newText("right", "<div class='fancy'> (100) TOTALMENTE ACEITÁVEL </div>") )
            .labelsPosition("top")
            .cssContainer({"margin":"1em"})
            .slider()
            .center()
            .size(400).css("max-width", "unset")
            .log()
            .print()
            ,
        
        newText(`
    <span style='width: 2em; text-align: left;'>0</span>
            <span style='width: 2em; text-align: center;'>25</span>
            <span style='width: 2em; text-align: center;'>50</span>
            <span style='width: 2em; text-align: center;'>75</span>
            <span style='width: 2em; text-align: right;'>100</span>`)
        .css({display: 'flex', 'justify-content': 'space-between', width: '20em'})
        .print()
            ,
    
        newButton("go_to_exercise", "Próximo")
            .cssContainer({"margin":"1em"})
            .center()
            .print()
            .wait()
            ,
    
            // Wait briefly to display which option was selected
            newTimer("wait", 300)
                .start()
                .wait()
        )

    And This is the demonstration link to my experiment.

    Thanks for your help!

    • This reply was modified 1 year, 10 months ago by yasufmg.
    • This reply was modified 1 year, 10 months ago by yasufmg.
    • This reply was modified 1 year, 10 months ago by yasufmg.
    • This reply was modified 1 year, 10 months ago by yasufmg.
    #8227
    Jeremy
    Keymaster

    Hi Yasmin,

    You center the Scale but not the Text element, which is why the two do not appear aligned together

    Jeremy

    #8245
    yasufmg
    Participant

    Hi, Jeremy!

    Thank you very much! It works perfectly. =)

    I’m currently having some problems reading my demo results.csv file in RStudio. It seems like it doesn’t recognize all # comments as columns. I’ve tried using the PCIBEX function as well but it doesn’t seem to work either. Is there a way to solve it?

    Thanks!

    Yasmin.

    #8246
    yasufmg
    Participant

    Hi, Jeremy!

    Sorry, I just realized they’re not supposed to appear as columns names! But my reaction times seem a bit off as they’re all showing “1.655924e+12”. I can send you the file if you want. Thanks!

    #8256
    Jeremy
    Keymaster

    Hi Yasmin,

    My apologies for the late reply. What is the error you encounter when trying to use read.pcibex? That function should output a table whose columns are named after the comments lines

    1.655924e+12 is a visual representation of a number composed of 13 digits used by whatever software you are using to view it, but the internal representation of the number is effectively between 1655924000000 and 1655924999999 (depending on how the software decided to truncate/round the number in its exponent representation)

    Jeremy

    #8321
    yasufmg
    Participant

    Hi, Jeremy! Thank you for your kind answer!

    I figured out how to use the read.pcibex function in RStudio! Thank you =)

    I used a sliding scale in my experiment, and now I’m wondering: is “727” in the comments column the reaction time? I’ll paste a row of my results file.

    # 1. Results reception time.
    # 2. MD5 hash of participant's IP address.
    # 3. Controller name.
    # 4. Order number of item.
    # 5. Inner element number.
    # 6. Label.
    # 7. Latin Square Group.
    # 8. PennElementType.
    # 9. PennElementName.
    # 10. Parameter.
    # 11. Value.
    # 12. EventTime.
    # 13. CERTIFICADO.
    # 14. ESCOLARIDADE.
    # 15. IDADE.
    # 16. NATIVO.
    # 17. GENERO.
    # 18. ID.
    # 19. Comments.
    # 19. ITEM.
    # 20. CONTEXT.
    # 21. SENTENCE.
    # 22. Comments.
    
    1657146924,MD5EDITED,PennController,25,0,experiment-filler,NULL,Scale,slider,Choice,99,1657146599275,EDITED@gmail.com,Curso universitário completo ou cursando,22,Sim,Feminino,NAME EDITED,805,CONTEXT,SENTENCE,727

    Thank you for your time!

    Yasmin.

    #8324
    Jeremy
    Keymaster

    Hi Yasmin,

    Yes, that is the reaction time: the line you pasted tells you that the participant clicked on the slider at timestamp 1657146599275-727 = 1657146598548 and released the click (most likely after sliding) 727ms later (ie. timestamp 1657146599275)

    Jeremy

    #10362
    nasimbhmn
    Participant

    Hi Jeremy,
    I have a related question, so I am asking it below this thread.

    In the example template you created above, let’s assume I have a column “QUESTION” but only in the fillers table. And this column is empty for half of the filler items. I have revised your script as below, but I receive an error message saying that “No column named ‘QUESTION’ found in table experimental.csv”. Could you please help me resolve it?

    experimental.csv:

    ITEM,SENTENCE,COMPATIBILITY,SUBJECT,LIST,TYPE, 
    101,Sentence 1,1,subject1,A,item
    201,Sentence 2,1,subject1,B,item
    102,Sentence 3,2,subject2,B,item
    202,Sentence 4,2,subject2,A,item

    fillers.csv:

    ITEM,SENTENCE,COMPATIBILITY,SUBJECT,TYPE,QUESTION
    501,Filler 1,.,.,filler,QUESTION501
    502,Filler 2,.,.,filler,
    503,Filler 3,.,.,filler,QUESTION502

    Sample script:

    function_for_template = row => newTrial( row.TYPE ,
          newText( row.SENTENCE ).print()
          ,
          newScale("answer", "True", "False").button().print().log().wait()
          ,
          ...(table.Question!==undefined && table.QUESTION ? [
                newText("question", table.QUESTION).print()
                ,
                newScale("answer", "yes", "no")
                    .keys("f", "j")
                    .button()
                    .print()
                    .log()
                    .wait()
            ] : [null])
    )
    .log("item", row.ITEM)
    .log("compatibility", row.COMPATIBILITY)
    .log("subject", row.SUBJECT)
    .log("list", (row.LIST===undefined?"filler":row.LIST))
    
    Template("experimental.csv", function_for_template)
    Template("fillers.csv", function_for_template)

    Thanks in advance!

    • This reply was modified 1 year, 1 month ago by nasimbhmn.
    #10366
    nasimbhmn
    Participant

    Oh btw, it seems that this chunk doesn’t work either: row.LIST===undefined?"filler":row.LIST). The error message says No column named ‘LIST’ found in table fillers.csv.

    #10370
    Jeremy
    Keymaster

    Hi,

    Did you mean to write row.Question!==undefined && row.QUESTION instead? Because the error you should get should be about table not being defined

    You can use hasOwnProperty to check that an object has an attribute: ...(row.hasOwnProperty("Question") && table.QUESTION ? [

    and also further down: .log("list", (row.hasOwnProperty("LIST")?"filler":row.LIST))

    Jeremy

    #10429
    nasimbhmn
    Participant

    Hi Jeremy,

    Thanks for the reply. Sorry, I had a typo in my example but not in my script. It seems that undefined does not work in PCIbex, but hasOwnProperty works perfectly.
    Just a minor comment on the log command (in case somebody needs to use it); it should be: .log("list", (row.hasOwnProperty("LIST")?row.LIST:"filler")).

    Best, Nasim

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