A correct response occurs when the letter in the response column is the same as the letter in the middle position of item in the stimulus column. Create an accuracy column that codes whether the response was correct or incorrect on each trial (coding can be TRUE/FALSE, 0/1, or some other coding scheme that identifies correct vs incorrect)
The stimulus_onset column gives a computer timestamp in milliseconds indicating when the stimulus was presented. The response_time column is a timestamp in milliseconds for the response. The difference between the two (response_time - stimulus_onset) is the reaction time in milliseconds. Add a column that calculates the reaction time on each trial.
tip: notice that the numbers in response_time and stimulus_onset have the class integer64. Unfortunately, ggplot does not play nice with integers in this format. you will need to make sure your RT column is in the class integer or numeric.
Check how many trials each subject completed in the congruent and incongruent conditions, the mean accuracy for each subject in each congruency condition, and the mean RT for each subject in each congruency condition.
subject | congruency | num_trials | mean_RT | mean_accuracy |
---|---|---|---|---|
1.txt | C | 96 | 550.5312 | 0.9166667 |
1.txt | I | 96 | 548.9375 | 0.9270833 |
10.txt | C | 96 | 1075.3646 | 0.9479167 |
10.txt | I | 96 | 1140.5521 | 0.9166667 |
11.txt | C | 96 | 708.2083 | 0.9375000 |
11.txt | I | 96 | 852.8958 | 0.9583333 |
12.txt | C | 96 | 622.8542 | 0.9270833 |
12.txt | I | 96 | 682.3854 | 0.0833333 |
13.txt | C | 96 | 545.4375 | 0.8958333 |
13.txt | I | 96 | 598.9375 | 0.8229167 |
14.txt | C | 96 | 719.7708 | 0.9687500 |
14.txt | I | 96 | 742.8333 | 0.9375000 |
15.txt | C | 96 | 631.7917 | 0.9895833 |
15.txt | I | 96 | 689.6458 | 0.9791667 |
16.txt | C | 96 | 572.5104 | 0.9583333 |
16.txt | I | 96 | 584.9062 | 0.9687500 |
17.txt | C | 96 | 633.2812 | 0.9687500 |
17.txt | I | 96 | 620.8958 | 0.9479167 |
18.txt | C | 96 | 802.3542 | 1.0000000 |
18.txt | I | 96 | 817.5938 | 0.9583333 |
19.txt | C | 96 | 1002.3542 | 0.9791667 |
19.txt | I | 96 | 1105.2917 | 0.9895833 |
2.txt | C | 96 | 1002.9167 | 1.0000000 |
2.txt | I | 96 | 1008.2917 | 0.9583333 |
20.txt | C | 96 | 669.8542 | 0.9895833 |
20.txt | I | 96 | 690.9688 | 1.0000000 |
21.txt | C | 96 | 840.6667 | 1.0000000 |
21.txt | I | 96 | 904.8646 | 1.0000000 |
22.txt | C | 96 | 795.1250 | 0.9687500 |
22.txt | I | 96 | 713.2083 | 0.9479167 |
3.txt | C | 96 | 812.5104 | 0.9895833 |
3.txt | I | 96 | 803.8646 | 0.9687500 |
4.txt | C | 96 | 815.3542 | 0.9895833 |
4.txt | I | 96 | 901.7500 | 0.9791667 |
5.txt | C | 96 | 819.5104 | 0.9791667 |
5.txt | I | 96 | 941.4167 | 0.9687500 |
6.txt | C | 96 | 667.9583 | 0.9687500 |
6.txt | I | 96 | 688.9688 | 0.9687500 |
7.txt | C | 96 | 1053.1667 | 0.9895833 |
7.txt | I | 96 | 1146.2604 | 1.0000000 |
8.txt | C | 96 | 611.8646 | 0.8645833 |
8.txt | I | 96 | 632.7604 | 0.9895833 |
9.txt | C | 96 | 695.5000 | 0.9687500 |
9.txt | I | 96 | 776.3646 | 0.9583333 |
It is common to exclude Reaction times that are very slow. There are many methods and procedures for excluding outlying reaction times. To keep it simple, exclude all RTs that are longer than 2000 ms
Get the individual subject mean reaction times for correct congruent and incongruent trials.
Get the overall mean RTs and SEMs (standard errors of the mean) for the congruent and incongruent condition. Make a table and graph.
congruency | meanRT | SEM |
---|---|---|
C | 734.7581 | 29.77926 |
I | 774.1644 | 32.58895 |
tip: Not all problems have an easy solution in dplyr, this is one them. You may have an easier time using logical indexing of the dataframe to solve this part.
Multiple questions may often be asked of data, especially questions that may not have been of original interest to the researchers.
In flanker experiments, like this one, it is well known that the flanker effect is modulated by the nature of the previous trial. Specifically, the flanker effect on trial n (the current trial), is larger when the previous trial (trial n-1) involved a congruent item, compared to an incongruent item.
Transform the data to conduct a sequence analysis. The dataframe should already include a factor (column) for the congruency level of trial n. Make another column that codes for the congruency level of trial n-1 (the previous trial). This creates a 2x2 design with trial n congruency x trial n-1 congruency.
First get teh subject means for each condition, then create a table and plot for teh overall means and SEMs in each condition. This should include:
tip: be careful, note that the first trial in each experiment can not be included, because it had no preceding trial
congruency | n1_congruency | mean_RT | SEM |
---|---|---|---|
C | C | 714.0920 | 29.62445 |
C | I | 753.3938 | 30.77720 |
I | C | 795.7701 | 33.81697 |
I | I | 748.9581 | 32.50715 |