Randomization by feature and by item

PennController for IBEX Forums Support Randomization by feature and by item

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #9586
    BenG
    Participant

    Hi Jeremy,

    I am designing an experiment in which participants will be shown a list of semantic features. For each feature, the participant will be shown a list of items and will have to decide whether the feature fits that item (e.g. does feature “is round” apply to item “pear”). All items are presented for each feature.

    I would like participants to see all features and all items randomly, however, when each feature is presented I would like all the items (in a random order) to be presented before moving on to the next feature. I have tried doing so by having separate .csv files (Features_SemVer.csv and Items_SemVer.csv) as well as by creating a combined excel in which every possible combination of feature and item is presented in columns (Features_SemVerMixed). I have not been able to make this work so far.

    Any help would be greatly appreciated!

    Demo link: https://farm.pcibex.net/r/RTusyr/

    #9594
    Jeremy
    Keymaster

    Hi,

    One option is to report the features in your table (as you are currently doing in Features_SemVerMixed.csv) and label your items accordingly: newTrial( row.Feature + "-" + row.Item ,

    Then you can reference the labels in your Sequence command. This would show items 1-to-5 in a fixed order for each feature, with the feature groups of items randomized:

    features = [...new Array(10)].map((v,n)=>startsWith("Feature "+Number(n+1)))
    fisherYates(features)
    Sequence("WelcomeConsent",
        "counter",
        "demographics",   
        "instructions1",
        "exercise",
        "startofexp",
        ...features,
        SendResults(),
        "Bye");

    If you would like to additionally randomize the order of the items within each feature group, replace the first line with:

    features = [...new Array(10)].map((v,n)=>randomize(startsWith("Feature "+Number(n+1))))

    Jeremy

    #9608
    BenG
    Participant

    Hi Jeremy,

    Thank you for your detailed response, that works perfectly! My only issue is that now the column “Instructions” in Features_SemVerMixed.csv appears to be randomized along with the other columns. Is there any way for this column to run in order while the others are randomized?

    I am trying to print the text “Attention: New Feature” whenever the feature changes – that is what is contained in this column.

    Thank you!

    #9616
    Jeremy
    Keymaster

    Hi,

    The columns are not randomized: the features array is randomized, which contains predicates over labels of trials; in effect, it is the order in which the trials are inserted in the sequence that is randomized, not the table or its columns, and not the way the trials are created more generally

    If you want to detect a change in feature upon runtime, you can use a global Var element to remember the value of the Feature column from the trial that was run before the current one, and compare the value of that Var element with the current value of row.Feature: if they are different, it means the current trial is starting a new feature block:

    newTrial( row.Feature + "-" + row.Item ,
      newText("instruct_exerc", "Bitte bewerten Sie, ob beide Tiere gleich gut Verursacher oder Empfänger der Handlung sein können.")
        .css({'font-family': "helvetica"})
        .center()
        .print()
        ,
      newVar("feature")
        .global().test.is( row.Feature ).failure(
          newText("feature_change", "Attention: New Feature ")
            .cssContainer({"margin-top":"2em", "margin-bottom":"2em", 'font-family': "helvetica"})
            .css("font-size", "1.2em").color("Red").bold().center()
            .print()
        )
        .set( row.Feature )
      ,

    Jeremy

    #9639
    BenG
    Participant

    That works perfectly, thank you!

    #9655
    BenG
    Participant

    Hi Jeremy,

    One last question: is there any way to use the pick function with the features array? I would like to add a few breaks, but am not sure how to do this without the pick function. I have tried the following, however it causes the experiment not to run:

    pick(features,500),”break”,
    pick(features,500),”break”,
    pick(features,500),

    Thank you!

    #9660
    Jeremy
    Keymaster

    Hi,

    The pick function only accepts IBEX-style predicates as an argument (eg. randomize("label")) but features is a 10-ary array, so passing it to pick directly won’t work

    You can create a (sub)sequence from it though, using IBEX’s seq function: seq(...features)

    So you could do that:

    featuresSeq = seq(...features)
    Sequence("WelcomeConsent",
        "counter",
        "demographics",   
        "instructions1",
        "exercise",
        "startofexp",
        pick(featuresSeq,500),"break",
        pick(featuresSeq,500),"break",
        pick(featuresSeq,500),
        SendResults(),
        "Bye");

    Jeremy

    #9685
    BenG
    Participant

    Hi Jeremy,

    That works perfectly, thank you!

    I noticed that when I increase the number of Features (currently 119), the code mistakes larger numbers beginning with the same number (e.g. 60, 63, 67, 69, etc.) as one feature (i.e., Feature 6). When this happens, instead of presenting one feature and all the items in a random order, it presents a different feature (beginning with that number) each time along with a random item. This happens a few times per experiment.

    Is there any way I can specify that the whole number (up to three digits) of Feature be taken into account?

    Thank you in advance.

    #9712
    MKonrad
    Participant

    Hi,

    I think the problem lies in the prefix specified in startsWith. Since all features “Feature 60” to “Feature 69” start with “Feature 6” they’re mixed up. Adding “-” to the common prefix after the number should fix this.

    Change the line 40 as follows **and delete line 41** and it should work:

    
    features = [...new Array(119)].map((v,n)=>randomize(startsWith("Feature "+Number(n+1)+"-")))
    

    Best,
    Markus

    • This reply was modified 1 year, 5 months ago by MKonrad.
    • This reply was modified 1 year, 5 months ago by MKonrad.
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.