PennController for IBEX › Forums › Support › Unable to randomize fillers and experimental items
- This topic has 14 replies, 3 voices, and was last updated 1 year, 8 months ago by nasimbhmn.
-
AuthorPosts
-
May 1, 2022 at 9:25 pm #8138yasufmgParticipant
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,.,.,.,fillerUnfortunately, 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!
May 2, 2022 at 10:40 am #8139JeremyKeymasterHi,
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 useTemplate
twice, once on each CSV tableexperimental.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
May 25, 2022 at 6:07 pm #8207yasufmgParticipantHi, 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.
May 26, 2022 at 5:15 pm #8208JeremyKeymasterHi 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
June 6, 2022 at 1:46 pm #8219yasufmgParticipantHi, 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!
June 8, 2022 at 12:57 pm #8227JeremyKeymasterHi Yasmin,
You
center
the Scale but not the Text element, which is why the two do not appear aligned togetherJeremy
June 23, 2022 at 7:34 pm #8245yasufmgParticipantHi, 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.
June 24, 2022 at 2:29 pm #8246yasufmgParticipantHi, 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!
July 7, 2022 at 12:55 pm #8256JeremyKeymasterHi 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 lines1.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 between1655924000000
and1655924999999
(depending on how the software decided to truncate/round the number in its exponent representation)Jeremy
August 2, 2022 at 3:54 pm #8321yasufmgParticipantHi, 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.
August 4, 2022 at 5:08 pm #8324JeremyKeymasterHi 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. timestamp1657146599275
)Jeremy
March 10, 2023 at 8:45 pm #10362nasimbhmnParticipantHi 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, 8 months ago by nasimbhmn.
March 11, 2023 at 4:03 pm #10366nasimbhmnParticipantOh btw, it seems that this chunk doesn’t work either:
row.LIST===undefined?"filler":row.LIST)
. The error message saysNo column named ‘LIST’ found in table fillers.csv
.March 13, 2023 at 11:56 am #10370JeremyKeymasterHi,
Did you mean to write
row.Question!==undefined && row.QUESTION
instead? Because the error you should get should be abouttable
not being definedYou 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
March 30, 2023 at 3:05 pm #10429nasimbhmnParticipantHi 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, buthasOwnProperty
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
-
AuthorPosts
- You must be logged in to reply to this topic.