Pick out items after randomization

PennController for IBEX Forums Support Pick out items after randomization

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #9644
    nianpo
    Participant

    Hi Jeremy,

    I am wondering if it is possible to pick out items after randomization (Latin square design). For example, I have four conditions of experimental sentences, and after randomization, I want Short sentences (Short1 and Short2) to appear first and Long sentences (Long1 and Long2) to appear next. I am thinking about adding an ‘if’ loop to go over all the list: if the sentence belongs to ‘Short’, it will be shown; if not, it will be kept in the list until all the ‘Short’ sentences are shown.

    Say I have 4 sets, and each set has 4 conditions.

    Group  Set  Condition  Distance 
    1      1    Short1      Short
    2      1    Short2      Short
    3      1    Long1       Long
    4      1    Long2       Long
    2      2    Short1      Short
    3      2    Short2      Short
    4      2    Long1       Long
    1      2    Long2       Long
    3      3    Short1      Short
    4      3    Short2      Short
    1      3    Long1       Long
    2      3    Long2       Long
    4      4    Short1      Short
    1      4    Short2      Short
    2      4    Long1       Long
    3      4    Long2       Long

    I would like to have:

    1. Fully randomization first, e.g., Set1_Short2, Set3_Long1, Set4_Long2, Set2_Short1.
    2. Pick out ‘Short’ items before ‘Long’ items: Set1_Short2, Set2_Short1, Set3_Long1, Set4_Long2.
    3. Mix the new list with fillers

    Is there any way to make this possible? Your kind help is very much appreciated!

    Best wishes,
    Nianpo

    #9648
    Jeremy
    Keymaster

    Hi,

    If you are not familiar with the way (PC)Ibex offers control over the sequence of trials, I recommend reading the PCIbex documentation on labels and the original IBEX manual

    In your case, all you need to do to get 1+2 is properly label the trials so you can reference them appropriately in predicates (randomize) in the Sequence command:

    Template( row =>
      newTrial( row.Condition+"_Set"+row.Set ,
        // etc.
    
    Sequence( randomize(startsWith("Short")) , randomize(startsWith("Long")) )

    Mixing fillers in is more complex if you have a single set of fillers that should be distributed across the “Short” and “Long” trials. If you know in advance how many filler trials you’ll have (say, 40) you could use the custom pick function to randomly pick half (20) of those trials and mix them in with the “Short” trials, and mix the other half in with the “Long” trials:

    fillers = randomize("Filler") // assuming all your filler trials are labeled "Filler"
    
    Sequence(
      rshuffle( startsWith("Short") , pick(fillers,20) ),
      rshuffle( startsWith("Long")  , pick(fillers,20) )
    )

    Jeremy

    • This reply was modified 1 year, 4 months ago by Jeremy. Reason: added missing closing parentheses
    #9651
    nianpo
    Participant

    Hi Jeremy,

    Thank you for your helpful reply! I tried the code you suggested (as below), but I still have a problem: I have 20 sets in total, but only 10 sentences with Distance ‘Short’ are shown now. No sentences with Distance ‘Long’ is shown. I guess that’s because my ‘Short’ and ‘Long’ sentences have the same set. Is there any chance to solve this problem?

    Template("extable.csv", row =>
      newTrial( row.Distance + row.Set,
        defaultText
            .center()
            .print()
        ,
        newText("sentence", row.Sentence)
        ,
        newScale("acceptability", 7)
            .labelsPosition("bottom")
            .before( newText("very unnatural") )
            .after( newText("very natural") )
            .center()
            .log()
            .print()
            .wait()
        ,
        newText("space"," ")
        ,
        newButton("proceed")
            .center()
            .print()
            .wait('first')
            ,
        clear()
        ))
    
    Sequence( rshuffle(startsWith("Short") , rshuffle(startsWith("Long") )))

    Thank you again for your kind help! Looking forward to hearing from you 🙂

    Best wishes,
    Nianpo

    #9656
    Jeremy
    Keymaster

    Hi,

    When I try your code with the table you posted above (adding a “Sentence” column) I do get both “Long” and “Short” trials included in the experimental sequence. Do you have a link to your experiment so I can help troubleshoot?

    Jeremy

    #9658
    nianpo
    Participant

    Hi Jeremy,

    Thank you for your quick response! Here is the link:

    https://farm.pcibex.net/r/GUygym/

    The sentences are in Japanese but they all belong to “Long” sentences since I used the code ‘Sequence( rshuffle(startsWith(“Long”) , rshuffle(startsWith(“Short”) ))).’ Below are the first few lines of my csv file.

    Group Set Condition Distance Sentence
    1 1 IN_1 Short 理恵に飲み物を、健太は渡した。
    2 1 IN_2 Short 理恵に、飲み物を、健太は渡した。
    3 1 LD_1 Long 理恵に飲み物を、健太は直樹が渡したと聞いた。
    4 1 LD_2 Long 理恵に、飲み物を、健太は直樹が渡したと聞いた。
    2 2 IN_1 Short 莉子にハンチングを、大翔はかぶせた。
    3 2 IN_2 Short 莉子に、ハンチングを、大翔はかぶせた。
    4 2 LD_1 Long 莉子にハンチングを、大翔は咲那がかぶせたと聞いた。
    1 2 LD_2 Long 莉子に、ハンチングを、大翔は咲那がかぶせたと聞いた。

    Thank you for your kind help in advance! Looking forward to hearing from you 🙂

    Best wishes,
    Nianpo

    #9661
    Jeremy
    Keymaster

    Hi Nianpo,

    So, your Sequence line is Sequence( randomize(startsWith("Long") , randomize(startsWith("Short") ))), which corresponds to what I originally included in my post; what you included in your post, Sequence( rshuffle(startsWith("Short") , rshuffle(startsWith("Long") ))) does include “Short” trials

    There is a typo in the former, which I since corrected by editing my post, where the closing parenthesis of the first randomize only comes after the second randomize, effectively ignoring that one and thus just including the randomized “Long” trials. The line you want to use is Sequence( randomize(startsWith("Long")) , randomize(startsWith("Short")) )

    Jeremy

    #9662
    nianpo
    Participant

    Hi Jeremy,

    It worked now! Thank you very much & have a wonderful day 🙂

    Warmly,
    Nianpo

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