-
Notifications
You must be signed in to change notification settings - Fork 1
/
analysis-12-2-13.R
55 lines (44 loc) · 1.57 KB
/
analysis-12-2-13.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
d=read.csv("~/Dropbox/Experiments/exactly/dice-js/Submiterator/dice-pilot-12-1-13.results-parsed.csv", header=T)
levels(d$language)
d = subset(d, language != "spanish")
length(levels(factor(d$workerid))) # 99
# d$attentionCheckPassed = T
# for (i in 1:length(d$rt)) {
# if (d[i,]$attentionCheck == 'Yes') {
# if (d[i,]$requestedValue != d[i,]$response) {
# d[i,]$attentionCheckPassed = F
# }
# }
# }
# remove workerid 'A2VWG0L5JHOBWN', who failed both attention checks
d = subset(d, workerid != 'A2VWG0L5JHOBWN')
d = subset(d, attentionCheck == 'No')
# plot(density(log(rt)))
numeral = function(t) {
if (t == 'four') return(4)
if (t == 'five') return(5)
if (t == 'six') return(6)
if (t == 'seven') return(7)
if (t == 'eight') return(8)
}
d$relevantNum = NA
for (i in 1:length(d$rt)) {
if (d[i,]$qcolor == 'red') {
d[i,]$relevantNum = d[i,]$numRed
} else {
d[i,]$relevantNum = d[i,]$numBlack
}
}
g = function(r) {
linguistic = numeral(r[16])
seen = r[23]
if (seen < linguistic) return("less")
if (linguistic == seen) return("equal")
if (seen > linguistic) return("more")
}
d$qual.condition = NA
for (i in 1:length(d$rt)) d[i,]$qual.condition = g(d[i,])
filt = aggregate(d$response, list(context=d$context, quantifier=d$quantifier, qual.condition=d$qual.condition), FUN=mean)
tapply(filt$x, list(filt$context, filt$quantifier, filt$qual.condition), identity)
filt.sd = aggregate(d$response, list(context=d$context, quantifier=d$quantifier, qual.condition=d$qual.condition), FUN=sd)
tapply(filt.sd$x, list(filt$context, filt$quantifier, filt$qual.condition), identity)