
CHC9012 | National Taiwan Normal University
Explore your data:
Please download the files for the content of Week 13, and place them in your PreprocessingAnalysesR folder.
π» Please start RStudio and select the project called PreprocessingAnalysesR.
Age
Min. 1st Qu. Median Mean 3rd Qu. Max.
19.00 23.00 30.00 35.12 49.00 65.00
β οΈ Be careful
We need to be careful when removing data! We need converging evidence and justify our choice.
Different types of evidence to identify non-valid participants:
ID_1_TimeReceived RT
1 1777517421 13571.0667
2 1777518106 805.1000
3 1777518142 808.9333
4 1777518178 808.5000
5 1777518214 806.3333
6 1777518250 813.2667
7 1777518286 811.7333
8 1777518322 814.4333
9 1777518359 811.2667
10 1777518398 806.8333
11 1777518439 814.5000
12 1777518549 813.5333
13 1777518588 805.7000
14 1777518627 812.1333
15 1777518665 810.1333
16 1777518704 815.0000
17 1777518742 812.1667
18 1777518781 815.3000
19 1777518820 812.9667
20 1777518859 814.9333
21 1777518898 814.5000
22 1777518937 810.2000
23 1777518975 812.4000
24 1777519013 807.5333
25 1777519052 814.6333
26 1777519104 813.5667
27 1777519142 815.1667
28 1777519180 813.4333
29 1777519233 814.9333
30 1777519270 814.8667
31 1777519304 807.6333
32 1777519458 608.8667
33 1777519500 815.4667
34 1777519539 692.3667
35 1777519798 8069.6667
36 1777952741 1511.9667
37 1778728888 3986.5667
38 1778729203 14339.8000
39 1778730554 4272.8333
40 1778737433 6259.6333
41 1778742733 5526.1333
42 1778763194 11567.2667
43 1778782660 6250.8000
Code to extract the data of one participant (here, Participant #9)
IndPart <- subset(data_OtherPart_FullData,
ID_1_TimeReceived == levels(data_OtherPart_FullData$ID_1_TimeReceived)[9])# Calculate the mean per Participant and Condition
data_OtherPart_CleanAbsolute$m_rt <- ave(data_OtherPart_CleanAbsolute$RT,
data_OtherPart_CleanAbsolute$ID_1_TimeReceived,
data_OtherPart_CleanAbsolute$Condition,
FUN = mean)
# 2. Calculate the SD per Participant and Condition
data_OtherPart_CleanAbsolute$sd_rt <- ave(data_OtherPart_CleanAbsolute$RT,
data_OtherPart_CleanAbsolute$ID_1_TimeReceived,
data_OtherPart_CleanAbsolute$Condition,
FUN = sd)
# 3. Subset the data to remove outliers
data_OtherPart_CleanAbsoluteRelative <- subset(data_OtherPart_CleanAbsolute,
RT >= (m_rt - 2.5 * sd_rt) &
RT <= (m_rt + 2.5 * sd_rt))FullData_NbTrials <- nrow(data_OtherPart_FullData)
TrimmedData_NbTrials <- nrow(data_OtherPart_CleanAbsoluteRelative)
# Number of trimmed trials
NbTrimmedTrials <- FullData_NbTrials - TrimmedData_NbTrials
NbTrimmedTrials
# Proportion (%)
NbTrimmedTrials*100/FullData_NbTrials[1] 14
[1] 4.666667
The proportion is below 5%, which is acceptable in experimental linguistics.
plot(data_OtherPart_CleanAbsoluteRelative$Value ~ data_OtherPart_CleanAbsoluteRelative$Condition)
summarySE(data_OtherPart_CleanAbsoluteRelative,
measurevar = "Value",
groupvars = "Condition") Condition N Value sd se ci
1 Grammatical 144 6.361111 1.304168 0.1086807 0.2148283
2 Ungrammatical 142 2.485915 2.041193 0.1712931 0.3386347
plot(data_OtherPart_CleanAbsoluteRelative$RT ~ data_OtherPart_CleanAbsoluteRelative$Condition)
summarySE(data_OtherPart_CleanAbsoluteRelative,
measurevar = "RT",
groupvars = "Condition") Condition N RT sd se ci
1 Grammatical 144 6131.653 4240.087 353.3406 698.4457
2 Ungrammatical 142 6111.190 4277.881 358.9918 709.7022
Why exloring the data?
We observed more variation in the ungrammatical condition. The next step is to understand the source of such variation.
We already did our best with the participants, so it is likely to be related to the sentences.
data_Grammatical <- droplevels(subset(data_OtherPart_CleanAbsoluteRelative,
Condition == "Grammatical"))
plot(data_Grammatical$Value ~ data_Grammatical$ItemNo)data_Ungrammatical <- droplevels(subset(data_OtherPart_CleanAbsoluteRelative,
Condition == "Ungrammatical"))
plot(data_Ungrammatical$Value ~ data_Ungrammatical$ItemNo)# Exploration of divergent ungrammatical sentences
data_Ungrammatical_OutlierValue <- subset(data_Ungrammatical, Value > 4)
data_Ungrammatical_OutlierValue_Summary <- droplevels(subset(data_Ungrammatical_OutlierValue,
select = c(ID_1_TimeReceived,
ItemNo,
Sentence)))
data_Ungrammatical_OutlierValue_Summary <- unique(data_Ungrammatical_OutlierValue_Summary)
data_Ungrammatical_OutlierValue_Overview <- table(data_Ungrammatical_OutlierValue_Summary$ItemNo)
data_Ungrammatical_OutlierValue_Overview
31 33 34 36 37 38 43 44 47 48 50 51 52 55 57 58
1 1 1 1 1 2 3 1 2 1 2 4 2 2 1 1
# Identify which ungrammatical sentences
data_Ungrammatical_OutlierValue_Overview <- as.data.frame(data_Ungrammatical_OutlierValue_Overview)
names(data_Ungrammatical_OutlierValue_Overview)[1] <- "ItemNo"
data_Ungrammatical_OutlierValue_Overview <- droplevels(subset(data_Ungrammatical_OutlierValue_Overview, Freq > 2))
data_Ungrammatical_OutlierValue_Overview <- left_join(data_Ungrammatical_OutlierValue_Overview,
data_Ungrammatical,
by = "ItemNo")
OutlierUngrammaticalSentences <- unique(data_Ungrammatical_OutlierValue_Overview$Sentence)
OutlierUngrammaticalSentences[1] The bus stops not at this corner anymore
[2] It matters not what they think of us
30 Levels: He needs not help with his homework today ...
Important
Please annotate the Markdown file from this week, knit to a PDF file, and upload on Moodle!