reaction time results appear in different two columns

PennController for IBEX Forums Support reaction time results appear in different two columns

This topic contains 26 replies, has 2 voices, and was last updated by Avatar iasmaa 2 weeks, 1 day ago.

Viewing 15 posts - 1 through 15 (of 27 total)
  • Author
    Posts
  • #6244
    Avatar
    iasmaa
    Participant

    Hi,

    I’m finished with data collection and now I got the results but the when I opened the results file, the reaction time of my target items is a different column of the filler items!

    A possible reason for that is that the filler items are written by me directly to the script.However, I made a template for the target items.

    target item:

    ,DashedSentence,1,For,1596972359450,For example the_dodo_birds are extinct. ,No,No,No_article,C,465,false,

    filler item:
    DashedSentence,1,But,1596972504366,458,false,

    As you can see, the filler items are more organized.

    How to make the results data consistent in terms of reaction time? Is there any way to fix that from pcibex now after already having the results?

    Thank you.

    #6248
    Jeremy
    Jeremy
    Keymaster

    Hi,

    As explained on the Controller element documentation page, extra columns will be appended at the end of the line because different types of controllers report different numbers of parameters.

    What you probably did is use log on the newTrial inside your Template, which also appends columns at the end of the line. Those take precedence over the ones appended by the Controller element, because the order of the different columns needs to be consistent across all rows corresponding to the different logged elements from the same trial: for example, if you log an extra “ParticipantID” column, it shouldn’t 13th in the line corresponding to a Button element from one trial, but 15th in the line corresponding to a Controller element from the same trial.

    Because you didn’t log those extra columns for you filler items (I assume) the Controller extra columns come earlier in the lines corresponding to the filler items. You will need to handle that externally to PCIbex. It’s an easy fix if you use R, for example, and I’d be happy to help you doing it. Just let me know

    Jeremy

    #6252
    Avatar
    iasmaa
    Participant

    Hi,

    Thank you for your replay.
    Yes I would appreciate your help in that…

    #6254
    Jeremy
    Jeremy
    Keymaster

    Hi,

    For this illustration, I created a dummy experiment with just two trials:

    newTrial( "rich_columns" ,
        newController("DashedSentence", {s: "This is a first test sentence"})
            .log()
            .print()
            .wait()
    )
    .log("extra_column1", "value of extra colum 1")
    .log("extra_column2", "value of extra colum 2")
    
    
    newTrial( "poor_columns" ,
        newController("DashedSentence", {s: "This is a second test sentence"})
            .log()
            .print()
            .wait()
    )

    I took the experiment once, and ended up with this results file (comment lines removed, MD5 hash replaced):

    1603727411,MD5ID,PennController,0,0,rich_columns,NULL,PennController,0,_Trial_,Start,1603727373087,value of extra colum 1,value of extra colum 2,NULL
    1603727411,MD5ID,PennController,0,0,rich_columns,NULL,Controller-DashedSentence,DashedSentence,1,This,1603727376797,value of extra colum 1,value of extra colum 2,289,false,This is a first test sentence,Any addtional parameters were appended as additional columns
    1603727411,MD5ID,PennController,0,0,rich_columns,NULL,Controller-DashedSentence,DashedSentence,2,is,1603727376797,value of extra colum 1,value of extra colum 2,251,false,This is a first test sentence,Any addtional parameters were appended as additional columns
    1603727411,MD5ID,PennController,0,0,rich_columns,NULL,Controller-DashedSentence,DashedSentence,3,a,1603727376797,value of extra colum 1,value of extra colum 2,215,false,This is a first test sentence,Any addtional parameters were appended as additional columns
    1603727411,MD5ID,PennController,0,0,rich_columns,NULL,Controller-DashedSentence,DashedSentence,4,first,1603727376797,value of extra colum 1,value of extra colum 2,236,false,This is a first test sentence,Any addtional parameters were appended as additional columns
    1603727411,MD5ID,PennController,0,0,rich_columns,NULL,Controller-DashedSentence,DashedSentence,5,test,1603727376797,value of extra colum 1,value of extra colum 2,229,false,This is a first test sentence,Any addtional parameters were appended as additional columns
    1603727411,MD5ID,PennController,0,0,rich_columns,NULL,Controller-DashedSentence,DashedSentence,6,sentence,1603727376797,value of extra colum 1,value of extra colum 2,291,false,This is a first test sentence,Any addtional parameters were appended as additional columns
    1603727411,MD5ID,PennController,0,0,rich_columns,NULL,PennController,0,_Trial_,End,1603727376807,value of extra colum 1,value of extra colum 2,NULL
    1603727411,MD5ID,PennController,1,0,poor_columns,NULL,PennController,1,_Trial_,Start,1603727376828,NULL
    1603727411,MD5ID,PennController,1,0,poor_columns,NULL,Controller-DashedSentence,DashedSentence,1,This,1603727378601,240,false,This is a second test sentence,Any addtional parameters were appended as additional columns
    1603727411,MD5ID,PennController,1,0,poor_columns,NULL,Controller-DashedSentence,DashedSentence,2,is,1603727378601,205,false,This is a second test sentence,Any addtional parameters were appended as additional columns
    1603727411,MD5ID,PennController,1,0,poor_columns,NULL,Controller-DashedSentence,DashedSentence,3,a,1603727378601,169,false,This is a second test sentence,Any addtional parameters were appended as additional columns
    1603727411,MD5ID,PennController,1,0,poor_columns,NULL,Controller-DashedSentence,DashedSentence,4,second,1603727378601,247,false,This is a second test sentence,Any addtional parameters were appended as additional columns
    1603727411,MD5ID,PennController,1,0,poor_columns,NULL,Controller-DashedSentence,DashedSentence,5,test,1603727378601,215,false,This is a second test sentence,Any addtional parameters were appended as additional columns
    1603727411,MD5ID,PennController,1,0,poor_columns,NULL,Controller-DashedSentence,DashedSentence,6,sentence,1603727378601,246,false,This is a second test sentence,Any addtional parameters were appended as additional columns
    1603727411,MD5ID,PennController,1,0,poor_columns,NULL,PennController,1,_Trial_,End,1603727378605,NULL

    I saved the file as results.csv and then used this R script:

    # First read the results file
    all_results <- read.csv("results.csv", header=F, sep=",", quote='"', comment.char='#')
    # We will work on the DashedSentence lines only
    dashed_results <- all_results
    # Name the columns based on the longer lines (ie the ones with extra1 and extra2)
    names(dashed_results) <- c("SubmitTime","MD5","Controller","ItemN","ElementN","Label","Group",
                               "Type","Name","Param","Value","EventTime","Extra1","Extra2",
                               "RT","LineBreak","Sentence","Comments")
    # Keep only the DashedSentence lines
    dashed_results <- subset(dashed_results, Type=="Controller-DashedSentence")
    # Let us first make the columns character-based instead of factors
    dashed_results$Comments <- as.character(dashed_results$Comments)
    dashed_results$Sentence <- as.character(dashed_results$Sentence)
    dashed_results$LineBreak <- as.character(dashed_results$LineBreak)
    dashed_results$RT <- as.character(dashed_results$RT)
    dashed_results$Extra2 <- as.character(dashed_results$Extra2)
    dashed_results$Extra1 <- as.character(dashed_results$Extra1)
    # Let us identify the short lines (the ones without extra1 and extra2)
    short_lines <- dashed_results$Label=="poor_columns"
    # Now let us move the columns
    dashed_results[short_lines,'Comments'] <- dashed_results[short_lines,'LineBreak']
    dashed_results[short_lines,'Sentence'] <- dashed_results[short_lines,'RT']
    dashed_results[short_lines,'LineBreak'] <- dashed_results[short_lines,'Extra2']
    dashed_results[short_lines,'RT'] <- dashed_results[short_lines,'Extra1']
    dashed_results[short_lines,'Extra2'] <- NA
    dashed_results[short_lines,'Extra1'] <- NA
    # Done!

    You’ll have to adapt this code to your case, of course. For example, I only have two extra-columns (the ones inserted by .log on newTrial) but judging from what you reported, it looks like you have 5 extra columns in your target items. Also, I labeled my trials rich_columns and poor_columns which, respectively, correspond to your target and filler items.

    I chose to keep the extra columns and fill them with NAs for the poor_columns lines, but alternatively you could just remove them altogether, in which case you would first need to move the columns of long_lines instead.

    Let me know if you have questions

    Jeremy

    #6259
    Avatar
    iasmaa
    Participant

    Hi,

    Thank you for this.
    That doesn’t work with me. I always got the error(object not found!).

    I tried to replace the (dashed_results) you used with (dashed_sentence) and the extras with my 5 extras but it still not working!

    #6260
    Avatar
    iasmaa
    Participant

    The error I got when trying to name the long line columns:

    Error in names(results222) <- c(“Controller”, “ItemN”, “ElementN”, “Label”, :
    ‘names’ attribute [16] must be the same length as the vector [14]

    as seen above, I changed (dashed results) with the name of my CSV file (results222) because it only works that way.

    #6262
    Jeremy
    Jeremy
    Keymaster

    Hi,

    The argument of names should be a data frame that contains the content of your results file, which you load with read.csv. In the code from my message above, I use a data frame named dashed_results, a copy of all_results in which I stored the output of read.csv; the argument of read.csv should be the name of your results file, so for example if your file is named results222 (double-check whether your file has an extension) then you need to replace "results.csv" with "results222" in read.csv. Then you want to adapt the vector of names to the columns from your own results file—you can use length(all_results) to see how many columns have the longest lines from your results file

    Jeremy

    #6263
    Avatar
    iasmaa
    Participant

    Hi,

    Thank you for the clarification.
    It is more clear now.

    I did not refer to labels when designing the experiment. So I did not identify that the template items are target and the others are filler. What to do in that case?

    #6265
    Jeremy
    Jeremy
    Keymaster

    You could check for the value of the last column (Comments) which will be empty for the short lines: replace short_lines <- dashed_results$Label=="poor_columns" with short_lines <- dashed_results$Comments==""

    Jeremy

    #6266
    Avatar
    iasmaa
    Participant

    Hi,

    I think I have a problem with the presentation of the column in csv format.
    It appears as I have 14 columns for both filler and target items, and the extra columns come under each item line!
    Which make the extra columns(the ones under each items) disappear in this stage of processing: dashed_results <- subset(dashed_results, Type==”Controller-DashedSentence”)

    #6268
    Jeremy
    Jeremy
    Keymaster

    Hi,

    Can you give me an example of a full target line and a full filler line (replace the MD5 hash, ie. the second column, to maximize anonymity) taken directly from your results file?

    Jeremy

    #6269
    Avatar
    iasmaa
    Participant

    target:

    1596973404	MD5HASH_EDITED	PennController	11	0	trials	NULL	Controller-DashedSentence	DashedSentence	1	For	1.59697E+12	For example yellow_chair is very attractive. 	No	No	A	C	792	FALSE	For example yellow_chair is very attractive. 	Any addtional parameters were appended as additional columns

    (the second line starts with No……etc. so it comes in the same first column in the cell under the first value (1596973404)

    filler:

    1596973404	MD5HASH_EDITED	PennController	39	0	trials	NULL	Controller-DashedSentence	DashedSentence	1	So	1.59697E+12	442	FALSE	So after Kevin came in Audrey sings a song.	Any addtional parameters were appended as additional columns		

    Here, FALSE comes in the second line (under the first value), So after Kevin came in Audrey sings a song (in the second column)…etc

    Hope it is clear.

    • This reply was modified 3 weeks, 5 days ago by Jeremy Jeremy. Reason: Replaced MD5 hash for full anonymity
    #6272
    Jeremy
    Jeremy
    Keymaster

    I’m surprised to see that the separator character in the lines you report is a tab rather than a comma. Did you save the results file on your device and then open it with a spreadsheet editor, by any chance?

    I edited your message to properly format the lines you report, and now you can see that they contain no line-break—you probably saw “second lines” just because of how the lines were rendered onto your screen, but they are not real second lines

    If you saved your results file with tab separators, you need to pass "\t" instead of "," as the sep argument of read.csv:

    all_results < - read.csv("results.csv", header=F, sep="\t", quote='"', comment.char='#')

    Jeremy

    #6274
    Avatar
    iasmaa
    Participant

    Hi,

    No I already separated them by comma when import the csv file into R. but I copied the example from the original text results to make it clear.
    Is there any way to insert a picture here to show you exactly how my results look like?

    #6276
    Jeremy
    Jeremy
    Keymaster

    Hi,

    Yes, you can upload your screenshot here, for example: https://onpaste.com/
    Then use the img button when you write your message here to paste the image’s URL

    Could you open your results file in a simple text editor (or even directly in your project on the farm) and paste the two results lines here?

    Jeremy

Viewing 15 posts - 1 through 15 (of 27 total)

You must be logged in to reply to this topic.