Skip to content

Instantly share code, notes, and snippets.

@chmullig
Last active August 29, 2015 14:15
Show Gist options
  • Save chmullig/5919bd1d7f87eaeff4f4 to your computer and use it in GitHub Desktop.
Save chmullig/5919bd1d7f87eaeff4f4 to your computer and use it in GitHub Desktop.
require(dplyr)
require(reshape2)
require(ggplot2)
mturk <- read.csv("What-If-Games-Were-Shorter-Data-MTurk.csv")
head(mturk)
tallturk <- melt(mturk, id.vars=c("ID"), variable.name="quarter", value.name="fav_win_prob")
tallturk <- tallturk[tallturk$quarter %in% c("FavWinProbQ1", "FavWinProbQ2", "FavWinProbQ3", "FavWinProbQ4"),]
tallturk <- tallturk[!is.na(tallturk$fav_win_prob),]
#convert to numeric
tallturk$quarter2[tallturk$quarter == "FavWinProbQ1"] <- 1
tallturk$quarter2[tallturk$quarter == "FavWinProbQ2"] <- 2
tallturk$quarter2[tallturk$quarter == "FavWinProbQ3"] <- 3
tallturk$quarter2[tallturk$quarter == "FavWinProbQ4"] <- 4
#add jitter to probabilities
tallturk$fav_win_prob2 <- tallturk$fav_win_prob + rnorm(nrow(tallturk))
ggplot(tallturk, aes(x=quarter2, y=fav_win_prob2, group=ID)) +
geom_smooth(aes(group=FALSE), alpha=1, color="blue") +
geom_line(alpha=.2) +
ggtitle("MTurk Respondents' Guess of Likelihood favorite is winning after each quarter") +
ylab("Respondent's Guessed Likelihood") + xlab("Quarter")
ggsave("mturk_clm2186.png")
We can make this file beautiful and searchable if this error is corrected: It looks like row 221 should actually have 22 columns, instead of 6. in line 220.
ID,FavWinProbQ4,FavLoseProbQ4,FavTieProbQ4,FavWinProbQ3,FavLoseProbQ3,FavTieProbQ3,FavWinProbQ2,FavLoseProbQ2,FavTieProbQ2,FavWinProbQ1,FavLoseProbQ1,FavTieProbQ1,ShortenGame,BestChance,PointsQ1,PointsQ2,PointsQ3,PointsQ4,FootballQuiz,Gender,Age
1,,,,,,,,,,,,,1,,,,,,5,1,22
2,,,,,,,,,,,,,,,3,3,7,7,5,2,34
3,,,,,,,,,,,,,1,,,,,,3,1,22
4,,,,,,,,,,,,,,5,,,,,4,2,50
5,80,20,0,80,20,0,60,20,20,25,25,50,,,,,,,5,1,25
6,,,,,,,,,,,,,,5,,,,,5,1,29
7,65,35,0,40,20,40,20,20,60,20,20,60,,,,,,,5,1,28
8,,,,,,,,,,,,,2,,,,,,4,2,24
9,,,,,,,,,,,,,,,2,3,2,1,1,2,26
10,50,40,10,60,40,0,70,30,0,40,40,20,,,,,,,5,2,39
11,,,,,,,,,,,,,,5,,,,,5,2,26
12,,,,,,,,,,,,,,,0,14,7,7,5,1,32
13,70,30,0,80,20,0,100,0,0,80,0,20,,,,,,,5,1,29
14,,,,,,,,,,,,,,,1,3,6,7,3,2,31
15,,,,,,,,,,,,,2,,,,,,5,1,26
16,60,40,0,50,40,10,50,40,10,45,45,10,,,,,,,5,1,53
17,55,44,1,40,27,33,40,27,33,40,27,33,,,,,,,5,1,51
18,,,,,,,,,,,,,1,,,,,,5,1,20
19,,,,,,,,,,,,,,,3,7,10,7,5,1,30
20,60,30,10,80,15,5,88,8,4,50,40,10,,,,,,,4,2,32
21,60,40,0,50,45,5,60,30,10,50,40,10,,,,,,,5,1,32
22,,,,,,,,,,,,,,3,,,,,5,1,23
23,,,,,,,,,,,,,,2,,,,,5,1,28
24,,,,,,,,,,,,,,5,,,,,5,2,31
25,,,,,,,,,,,,,1,,,,,,5,1,29
26,,,,,,,,,,,,,,,0,7,14,7,4,1,19
27,,,,,,,,,,,,,1,,,,,,5,1,26
28,,,,,,,,,,,,,2,,,,,,5,1,29
29,,,,,,,,,,,,,,,10,13,21,14,5,1,21
30,,,,,,,,,,,,,,,1,2,6,7,5,1,31
31,,,,,,,,,,,,,,,0,3,0,7,5,2,22
32,,,,,,,,,,,,,,5,,,,,5,1,27
33,,,,,,,,,,,,,,5,,,,,5,1,28
34,,,,,,,,,,,,,,,0,7,7,7,5,1,30
35,,,,,,,,,,,,,,1,,,,,5,2,27
36,,,,,,,,,,,,,,4,,,,,5,1,29
37,,,,,,,,,,,,,1,,,,,,3,2,20
38,80,20,0,70,10,20,60,10,30,50,10,40,,,,,,,5,2,48
39,,,,,,,,,,,,,2,,,,,,5,1,27
40,,,,,,,,,,,,,2,,,,,,5,1,25
41,80,19,1,75,20,5,60,30,10,40,40,20,,,,,,,5,1,27
42,60,40,0,55,40,5,60,30,10,45,30,25,,,,,,,5,1,26
43,,,,,,,,,,,,,2,,,,,,5,2,29
44,,,,,,,,,,,,,2,,,,,,5,1,32
45,40,40,20,40,40,20,40,40,20,40,40,20,,,,,,,5,2,52
46,,,,,,,,,,,,,,,3,7,14,7,5,1,26
47,54,44,2,45,40,15,40,40,20,35,35,30,,,,,,,5,1,34
48,85,14,1,70,20,10,60,30,10,50,40,10,,,,,,,5,2,31
49,70,25,5,60,30,10,55,30,15,45,30,25,,,,,,,5,1,29
50,,,,,,,,,,,,,,,1.5,3,4.5,7,5,1,29
51,,,,,,,,,,,,,,5,,,,,3,1,19
52,,,,,,,,,,,,,1,,,,,,5,2,29
53,45,40,15,50,25,25,50,25,25,50,25,25,,,,,,,3,1,50
54,,,,,,,,,,,,,,,3,7,14,7,5,1,24
55,60,20,20,70,20,10,80,10,10,50,40,10,,,,,,,4,1,30
56,,,,,,,,,,,,,1,,,,,,5,1,39
57,,,,,,,,,,,,,1,,,,,,5,1,27
58,,,,,,,,,,,,,,,0,3,4,7,5,1,22
59,,,,,,,,,,,,,2,,,,,,5,1,28
60,,,,,,,,,,,,,,,14,7,14,7,5,1,44
61,,,,,,,,,,,,,1,,,,,,1,2,18
62,65,35,0,65,35,0,55,45,0,50,50,0,,,,,,,5,1,28
63,,,,,,,,,,,,,,4,,,,,5,2,26
64,,,,,,,,,,,,,,,1.5,3,5,7,5,1,24
65,70,20,10,85,10,5,80,10,10,90,5,5,,,,,,,5,1,23
66,,,,,,,,,,,,,,1,,,,,5,1,27
67,80,18,2,80,10,10,60,20,20,40,40,20,,,,,,,5,2,48
68,,,,,,,,,,,,,,,0,3,10,10,1,1,20
69,65,25,10,80,10,10,50,40,10,40,40,20,,,,,,,5,1,29
70,65,35,0,70,25,5,50,45,5,20,20,60,,,,,,,5,1,28
71,,,,,,,,,,,,,2,,,,,,1,1,20
72,,,,,,,,,,,,,,,3,0,3,7,5,1,55
73,65,34,1,55,30,15,50,25,25,40,30,30,,,,,,,5,1,35
74,,,,,,,,,,,,,,1,,,,,5,2,36
75,,,,,,,,,,,,,,1,,,,,1,2,38
76,,,,,,,,,,,,,,5,,,,,5,1,25
77,15,10,75,25,25,50,35,65,0,85,0,15,,,,,,,3,2,29
78,,,,,,,,,,,,,,1,,,,,5,1,46
79,,,,,,,,,,,,,,3,,,,,5,1,39
80,60,40,0,55,35,10,55,25,20,25,20,55,,,,,,,5,1,29
81,70,20,10,60,30,10,50,40,10,70,20,10,,,,,,,5,2,25
82,,,,,,,,,,,,,1,,,,,,5,1,34
83,,,,,,,,,,,,,3,,,,,,5,2,26
84,,,,,,,,,,,,,,1,,,,,5,1,26
85,,,,,,,,,,,,,,,0,0,14,7,5,1,24
86,,,,,,,,,,,,,1,,,,,,5,1,28
87,,,,,,,,,,,,,,,0,3,0,7,5,1,39
88,,,,,,,,,,,,,2,,,,,,2,2,25
89,,,,,,,,,,,,,,,3,6,3,7,5,1,29
90,60,39,1,59,40,1,60,39,1,60,39,1,,,,,,,5,1,25
91,,,,,,,,,,,,,,4,,,,,5,1,25
92,50,50,0,50,50,0,50,50,0,50,50,0,,,,,,,5,1,36
93,60,30,10,60,30,10,50,30,20,40,30,30,,,,,,,4,2,23
94,,,,,,,,,,,,,,4,,,,,3,2,34
95,60,30,10,50,40,10,50,40,10,60,30,10,,,,,,,1,1,28
96,,,,,,,,,,,,,,4,,,,,5,1,40
97,,,,,,,,,,,,,,,7,14,2,21,4,1,23
98,,,,,,,,,,,,,2,,,,,,3,1,27
99,75,24,1,70,25,5,55,33,12,50,30,20,,,,,,,5,1,35
100,80,15,5,85,13,2,90,9,1,65,10,25,,,,,,,1,1,28
101,66,33,1,50,40,10,40,50,10,70,30,0,,,,,,,5,1,37
102,75,10,15,60,15,25,40,20,40,50,10,40,,,,,,,5,1,23
103,60,30,10,60,30,10,60,30,10,60,30,10,,,,,,,1,2,19
104,,,,,,,,,,,,,2,,,,,,5,2,41
105,,,,,,,,,,,,,2,,,,,,1,2,27
106,,,,,,,,,,,,,,,7,0,3,7,1,1,29
107,,,,,,,,,,,,,1,,,,,,5,1,28
108,80,10,10,90,10,0,70,20,10,60,30,10,,,,,,,5,1,43
109,70,15,15,50,0,50,50,0,50,50,0,50,,,,,,,5,1,21
110,,,,,,,,,,,,,,4,,,,,5,1,21
111,,,,,,,,,,,,,,,0,0,7,14,5,2,33
112,45,45,10,55,40,5,45,45,10,45,45,10,,,,,,,5,2,39
113,50,40,10,45,25,30,45,25,30,30,30,40,,,,,,,4,1,19
114,,,,,,,,,,,,,,,0,2,2,3,5,2,28
115,70,25,5,70,20,10,50,30,20,25,25,50,,,,,,,5,1,25
116,,,,,,,,,,,,,,5,,,,,5,1,44
117,,,,,,,,,,,,,1,,,,,,3,1,22
118,60,20,20,40,40,20,40,40,20,40,40,20,,,,,,,1,1,23
119,,,,,,,,,,,,,,,7,7,7,7,5,1,20
120,,,,,,,,,,,,,2,,,,,,3,1,58
121,75,23,2,30,30,40,30,30,40,25,25,50,,,,,,,5,1,21
122,,,,,,,,,,,,,,,12,12,13,19,5,2,30
123,,,,,,,,,,,,,1,,,,,,1,1,40
124,,,,,,,,,,,,,,,3,3,7,7,3,1,30
125,,,,,,,,,,,,,2,,,,,,5,1,21
126,,,,,,,,,,,,,,4,,,,,5,1,20
127,70,30,0,55,40,5,60,40,0,45,45,10,,,,,,,5,1,25
128,,,,,,,,,,,,,,4,,,,,5,1,27
129,85,15,0,80,15,5,75,10,15,50,20,30,,,,,,,5,1,32
130,,,,,,,,,,,,,,3,,,,,5,1,26
131,,,,,,,,,,,,,1,,,,,,5,1,22
132,,,,,,,,,,,,,,1,,,,,5,2,37
133,52,47,1,35,30,35,40,30,30,20,20,60,,,,,,,5,1,30
134,,,,,,,,,,,,,,,7,7,10,7,5,1,27
135,,,,,,,,,,,,,2,,,,,,5,1,25
136,,,,,,,,,,,,,,,0,10,3,10,5,1,28
137,40,40,20,40,40,20,35,45,20,20,40,40,,,,,,,1,1,24
138,,,,,,,,,,,,,2,,,,,,5,1,27
139,,,,,,,,,,,,,,3,,,,,5,2,41
140,,,,,,,,,,,,,,5,,,,,3,1,35
141,80,19,1,70,30,0,50,50,0,34,33,33,,,,,,,3,1,25
142,70,30,0,60,40,0,70,30,0,50,50,0,,,,,,,5,1,35
143,,,,,,,,,,,,,,2,,,,,5,1,26
144,,,,,,,,,,,,,,,3,3,7,7,5,2,47
145,100,0,0,100,0,0,100,0,0,100,0,0,,,,,,,1,2,20
146,80,19,1,70,20,10,65,20,15,55,30,15,,,,,,,5,1,22
147,,,,,,,,,,,,,,5,,,,,4,2,33
148,59,40,1,65,30,5,65,30,5,40,40,20,,,,,,,5,1,23
149,,,,,,,,,,,,,,5,,,,,5,1,32
150,,,,,,,,,,,,,,5,,,,,5,2,24
151,45,45,10,45,45,10,45,45,10,45,45,10,,,,,,,3,2,21
152,,,,,,,,,,,,,1,,,,,,5,2,21
153,80,15,5,85,10,5,70,20,10,50,30,20,,,,,,,5,1,38
154,,,,,,,,,,,,,,5,,,,,2,1,22
155,65,30,5,60,30,10,70,20,10,55,35,10,,,,,,,5,2,36
156,,,,,,,,,,,,,,,0,14,7,7,5,1,30
157,,,,,,,,,,,,,,,3,3,6,7,5,1,24
158,,,,,,,,,,,,,,,0,3,7,10,5,1,34
159,,,,,,,,,,,,,,,3,3,7,7,5,1,35
160,60,39,1,59,40,1,55,44,1,50,49,1,,,,,,,5,1,22
161,,,,,,,,,,,,,,,7,3,2,5,5,2,28
162,60,40,0,60,10,30,50,30,20,70,10,20,,,,,,,5,1,36
163,,,,,,,,,,,,,1,,,,,,5,2,23
164,,,,,,,,,,,,,2,,,,,,3,1,20
165,,,,,,,,,,,,,2,,,,,,5,1,37
166,,,,,,,,,,,,,,3,,,,,3,1,36
167,,,,,,,,,,,,,3,,,,,,5,1,41
168,,,,,,,,,,,,,1,,,,,,5,1,33
169,,,,,,,,,,,,,1,,,,,,5,1,26
170,69,31,0,70,30,0,50,50,0,50,50,0,,,,,,,5,1,25
171,,,,,,,,,,,,,,,2,5,10,7,1,2,19
172,,,,,,,,,,,,,1,,,,,,5,1,22
173,,,,,,,,,,,,,,,3,3,10,10,5,1,25
174,,,,,,,,,,,,,,2,,,,,5,1,26
175,55,40,5,50,30,20,45,20,35,40,10,50,,,,,,,5,1,26
176,75,20,5,60,20,20,55,15,30,40,30,30,,,,,,,4,1,26
177,90,10,0,90,10,0,90,10,0,90,10,0,,,,,,,5,1,22
178,,,,,,,,,,,,,,4,,,,,5,2,33
179,50,40,10,60,30,10,40,40,20,70,15,15,,,,,,,5,1,27
180,60,39,1,55,40,5,55,25,20,50,30,20,,,,,,,5,1,19
181,,,,,,,,,,,,,,,3,7,14,7,5,1,40
182,60,40,0,60,40,0,60,20,20,70,30,0,,,,,,,5,1,32
183,,,,,,,,,,,,,2,,,,,,3,1,45
184,,,,,,,,,,,,,3,,,,,,4,1,38
185,,,,,,,,,,,,,,4,,,,,3,2,35
186,50,40,10,40,40,20,40,40,20,20,20,60,,,,,,,4,1,24
187,,,,,,,,,,,,,,,0,3,5,7,5,1,49
188,,,,,,,,,,,,,,5,,,,,4,1,51
189,,,,,,,,,,,,,1,,,,,,2,1,21
190,75,25,0,70,30,0,60,40,0,50,50,0,,,,,,,5,1,27
191,,,,,,,,,,,,,,,0,7,7,14,5,1,22
192,,,,,,,,,,,,,1,,,,,,5,1,53
193,85,14,1,75,10,15,60,15,25,50,25,25,,,,,,,5,1,31
194,75,20,5,75,25,0,50,50,0,75,25,0,,,,,,,3,2,43
195,,,,,,,,,,,,,,,0,7,3,7,5,1,29
196,,,,,,,,,,,,,,,0,7,14,7,5,1,25
197,,,,,,,,,,,,,1,,,,,,5,1,24
198,80,19,1,65,25,10,50,30,20,30,30,40,,,,,,,5,1,32
199,,,,,,,,,,,,,,,0,7,7,7,5,1,54
200,,,,,,,,,,,,,,5,,,,,5,2,29
201,,,,,,,,,,,,,,,3,9,6,3,5,1,24
202,,,,,,,,,,,,,,,2,1,3,8,1,2,42
203,,,,,,,,,,,,,,3,,,,,5,1,19
204,,,,,,,,,,,,,,3,,,,,4,2,34
205,70,30,0,86,13,1,90,9,1,90,9,1,,,,,,,4,2,38
206,65,35,0,70,20,10,40,40,20,40,40,20,,,,,,,5,2,27
207,70,30,0,60,30,10,50,50,0,50,50,0,,,,,,,5,1,43
208,75,20,5,70,20,10,80,15,5,50,50,0,,,,,,,3,1,33
209,,,,,,,,,,,,,,,0,0,7,7,5,1,22
210,,,,,,,,,,,,,1,,,,,,1,1,19
211,,,,,,,,,,,,,,,3,14,7,7,5,1,27
212,90,10,0,70,30,0,80,20,0,90,10,0,,,,,,,5,1,33
213,,,,,,,,,,,,,1,,,,,,1,1,19
214,80,20,0,100,0,0,80,0,20,100,0,0,,,,,,,5,2,48
215,50,50,0,50,50,0,75,25,0,75,25,0,,,,,,,5,2,36
216,60,39,1,65,30,5,50,40,10,40,40,20,,,,,,,5,1,22
217,65,30,5,70,25,5,45,35,20,35,30,35,,,,,,,1,2,26
218,,,,,,,,,,,,,,3,,,,,5,2,20
219,70,25,5,70,25,5,75,20,5,70,30,0,,,,,,,3,1,33
220,,,,,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment