Choosing subet of items to present

PennController for IBEX Forums Support Choosing subet of items to present

Viewing 15 posts - 31 through 45 (of 56 total)
  • Author
    Posts
  • #6799
    apspj
    Participant

    Thanks, Jeremy!

    1 – “If I understand you correctly, your cond column will go from A through H (8 conditions) with 4 rows for each letter (4 items).”
    Yes!

    2 – “What I’m not clear about are your fillers: does your cond column go from filler-1 through filler-5 (5 types of fillers), with 4 rows for each one again (as hinted at by the repeated “1” in your example)?”
    Just to clarify I have 5 types of fillers with 8 in each type (the items for fillers are all different and do not repeat as in the experimental items). So I have 40 fillers in total to distribute.

    Great! I will try the code (I am happy I could understand the code lol). But, anyway, would it assure that the items (experimental and fillers) are randomly selected for each participant?

    Thanks,

    Ana.

    #6800
    Jeremy
    Keymaster

    But, anyway, would it assure that the items (experimental and fillers) are randomly selected for each participant?

    Yes, the script is run anew for each participant, so the randomize and sort(...) parts in particular will give you a (possibly) different output for each participant. This means that the pair of “A” trials will be random and (possibly) different for each participant, same thing for the pair of “B” trials and so on. The order in which those pairs are run will also be random and (possibly) different for each participant: one participant for example will see “E,E,filler-4,filler-1,C,C,…” and another one could see “C,C,filler-2,filler-3,A,A,…”

    Jeremy

    #6802
    apspj
    Participant

    Ok, so within a dashed sentence experiment I would have something like this?:

    Template("myTable.csv", 
        variable => newTrial("experiment",
        newController("DashedSentence", {s: 
    conditions = [
        pick(randomize(startsWith("A-")), 2),
        pick(randomize(startsWith("B-")), 2),
        // etc.
    ]
    .sort( ()=>Math.random()-0.5 ) // shuffle
    })
    #6805
    Jeremy
    Keymaster

    I’m not sure why you are trying to pass the conditions array as the s parameter of your DashedSentence Controller elements.

    The conditions array contains references to labeled trials, and its cells are therefore meant to feature in the Sequence command, as in my example.

    If you take a look at my example project, I simply use a single Button element in the trials I generate. That’s the part where you should use a Controller element with DashedSentence if you need to use it, and presumably reference row.sentence (or, to be consistent with your example, variable.sentence) as the s parameter. You can read more about how the Template command works here, and more about the Sequence command here

    Jeremy

    #6806
    apspj
    Participant

    I was not sure either. Getting into this world of programming now…

    So this is what I am trying but it does not seem to work (I put 1 item of each just to test):

    //Experiment
    conditions = [
        pick(randomize(startsWith("A")), 1),
        pick(randomize(startsWith("B")), 1),
        pick(randomize(startsWith("C")), 1),
        pick(randomize(startsWith("D")), 1),
        pick(randomize(startsWith("E")), 1),
        pick(randomize(startsWith("F")), 1),
        pick(randomize(startsWith("G")), 1),
        pick(randomize(startsWith("H")), 1)
    ]
    .sort( ()=>Math.random()-0.5)
    
    fillers = randomize(startsWith("dist"))
    
    Sequence( 
        conditions[0], pick(dist, 1),
        conditions[1], pick(fillers, 1),
        conditions[2], pick(fillers, 1),
        conditions[3], pick(fillers, 1),
        conditions[4], pick(fillers, 1),
        conditions[5], pick(fillers, 1),
        conditions[6], pick(fillers, 1),
        conditions[7], pick(fillers,1)
    )
    Template("myTable.csv",
        row => newTrial("experiment", row.cond + "-" + row.item,
            newController("DashedSentence", {s: row.sentence}
                .css("font-size", "20px")
                .css("font-family", "Calibri")
                .center()
                .print()
                .print()
                .log()
                .wait()
                .remove()
        )
      )
    )
    #6808
    Jeremy
    Keymaster

    This line row => newTrial("experiment", row.cond + "-" + row.item, labels all your trials "experiment" and does nothing of row.cond + "-" + row.item. If your table has A, B, etc. in cond, simply delete "experiment", and that part should work fine (I think)

    You also reference a variable dist in the first pick function of Sequence but you have defined no such variable: I think the variable name you mean there is fillers, which three lines above you have reference all the trials (in a random order) whose label starts with “dist”. You will only have such trials (that is, after deleting "experiment",) assuming that cond in your table is dist (or at least starts with dist) for your filler items

    One last thing: you need to close the parenthesis of you newController immediately after the } (and then accordingly delete one of the three closing parentheses at the end of your code)

    Because your calls to pick all have 1 as their second argument, your code will include 16 trials in your run: 1 experimental trial, 1 filler trial, 1 experimental trial, 1 filler trial, and so on

    FYI, you can also share code with me (and readers of the forum) by sharing the demonstration link of your project (option “Share” in your project’s right panel menu)

    Jeremy

    #6809
    apspj
    Participant

    Thanks a lot for all the help, Jeremy.

    The "experiment" in the code referred to the Sequence of presentation, which is as follows:
    Sequence("TCLE" (consent), "info","instructions", "treino" (trainning),"experiment", SendResults(), "end")

    I managed to creat all the parts pre-experiment and they are working really well. The problem is really in the "experiment" part, that is why I repeated it within newTrial. I made the changes you suggested and understood why row.cond + "-" + row.item makes no sense in my project. And yes, about dist it was a mistake, because I was changing to fillers in Brazilian Portuguese distratores, which is how it is coded in my table. But I turned it back to English, as fillers. So everything runs very well but it gets "experiment" does not open at all.

    //Experiment
            conditions = [
            pick(randomize(startsWith("A")), 1),
            pick(randomize(startsWith("B")), 1),
            pick(randomize(startsWith("C")), 1),
            pick(randomize(startsWith("D")), 1),
            pick(randomize(startsWith("E")), 1),
            pick(randomize(startsWith("F")), 1),
            pick(randomize(startsWith("G")), 1),
            pick(randomize(startsWith("H")), 1)
    ]
            .sort( ()=>Math.random()-0.5)
        
        fillers = randomize(startsWith("dist"))
    
    Sequence( 
        conditions[0], pick(fillers,1),
        conditions[1], pick(fillers,1),
        conditions[2], pick(fillers,1),
        conditions[3], pick(fillers,1),
        conditions[4], pick(fillers,1),
        conditions[5], pick(fillers,1),
        conditions[6], pick(fillers,1),
        conditions[7], pick(fillers,1)
    )
    Template("frases_utf_poss.csv",
        row => newTrial("experiment",
            newController("DashedSentence", {s: row.sentence})
                .css("font-size", "20px")
                .css("font-family", "Calibri")
                .center()
                .print()
                .print()
                .log()
                .wait()
                .remove()
            )
        )

    Ana.

    #6810
    Jeremy
    Keymaster

    The "experiment" in the code referred to the Sequence of presentation: Sequence("TCLE" (consent), "info","instructions", "treino" (trainning),"experiment", SendResults(), "end")

    But the Sequence command that we have been working on so far is not this one, it’s the one that you report later in your message:

    Sequence( 
        conditions[0], pick(fillers,1),
        conditions[1], pick(fillers,1),
        conditions[2], pick(fillers,1),
        conditions[3], pick(fillers,1),
        conditions[4], pick(fillers,1),
        conditions[5], pick(fillers,1),
        conditions[6], pick(fillers,1),
        conditions[7], pick(fillers,1)
    )

    If there is no reference to your trials labeled "experiment" in that Sequence command, then they won’t be included in the experiment

    Jeremy

    #6811
    apspj
    Participant

    Yes, I tried to call it as a newTrial("experiment", before DashedSentence or call the Sequence("experiment", But it seems I cannot get through it…

    Anyway, here goes part of the code: https://farm.pcibex.net/r/AebAtk/

    Ana.

    #6812
    Jeremy
    Keymaster

    Your experiment contains two Sequence commands, so PennController will ignore one of them. Because you use pick ahead of the second Sequence command and your file pick.js, which is supposed to define that function, is empty, the script crashes on the first call to pick and all the code below it, including the second Sequence command and the Template command that generates your trials labeled "experiment", is not executed.

    Your table does contain a cond column listing values from A to H and values starting with dist, so it does make sense to use row.cond + "-" + row.item in your project

    I have re-filled the file pick.js with the content from the project I initially shared and minimally edited your code along the lines of what we’ve discussed here, you can see the result here: https://farm.pcibex.net/r/MXPSBL/
    (note that it runs only 8 experimental trials and 8 fillers, for the reasons I mentioned above)

    Jeremy

    #6813
    apspj
    Participant

    Thank you very much for your time and patience, Jeremy!

    I understand now the issue with the first Sequence It works fine. Now I will make the adjustments.

    Thank you once again,

    Ana.

    #6829
    apspj
    Participant

    Hi Jeremy,

    The experiment works really well.

    But now, as an exercise, I performed my own experiment around 3 times just to check the results. I followed the steps on https://doc.pcibex.net/how-to-guides/data-transformation/ but I keep getting the following error:

    Error in count.fields(filepath, sep = ",", quote = NULL) : 
      'file' must be a character string or connection

    I’ve already verified if Windows somehow changed the comma separated file downloaded from PCIbex is into semicolon but I keep getting this error. And I don’t know if it is something related to the function.

    Thank you,

    Ana.

    #6830
    apspj
    Participant

    Hi Jeremy,

    Never mind, got it! I was downloading the .cvs file in “download file” in “results”. But now I decided to just open and save as “.txt” and it actually worked well with the function read.pcibex. I don’t know why it just worked for me with txt, but maybe it could be a note in the tutorial.

    Best,

    Ana.

    #6831
    Jeremy
    Keymaster

    Hi Ana,

    Glad to see that the issue has been fixed. However it shouldn’t matter whether you open your results file in a new tab and save it as a .txt file, or whether you click “download” to directly get a .csv file: the content is the same in both cases, it’s a comma-separated table.

    Judging from the error message that you got, I suspect that something went adrift with the filename that was passed to read.pcibex. Maybe saving the file with a .txt extension somehow helped in passing the proper value to the function

    Best,
    Jeremy

    #6861
    apspj
    Participant

    Hi, Jeremy!

    I created a csv table with a column “group” A, B, C, which are the lists to participants. I tested the demo link with a friend and it seems that we are getting the same list. Does the automatic arrangement of lists for each even-odd participant only works in the experiment link?

    Thanks,

    Ana.

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