-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAnne_Data_Levi_Plots.R
431 lines (345 loc) · 12.7 KB
/
Anne_Data_Levi_Plots.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
#Sample Plot
DSSurvey %>%
ggplot(aes(x = visitstotal, y = clinicdistance, color = gender_DS)) +
geom_point() +
geom_jitter() +
facet_wrap(~ income)
# Income vs Clinic Visits
DSSurvey %>%
group_by(income, DSvisit) %>%
summarize(n = n()) %>%
filter(!is.na(income)) %>%
ggplot(aes(x = DSvisit, y = income, color = n)) +
geom_point(na.rm = TRUE, size = 10) +
ggtitle('Income vs Clinic Visits')
# income and DS education against therapies
DSSurvey %>%
filter(income == "Less than $10,000"
) %>%
select(income, DSeducation, therapy_equine, DSage, ed_respond)
DSSurvey %>%
filter(!is.na(income)) %>%
#melt()
ggplot(aes(x = DSeducation, y = income, color = therapy_equine)) +
geom_point() +
geom_jitter() +
ggtitle('DS Education vs income for Equine Therapy')
DSSurvey %>%
filter(!is.na(income)) %>%
filter(!is.na(DSeducation)) %>%
ggplot(aes(x = DSeducation, y = income, color = therapy_PT)) +
geom_point() +
geom_jitter() +
ggtitle('DS Education vs income for Physical Therapy')
DSSurvey %>%
filter(!is.na(income)) %>%
filter(!is.na(DSeducation)) %>%
ggplot(aes(x = DSeducation, y = income, color = therapy_OT)) +
geom_point() +
geom_jitter() +
ggtitle('DS Education vs income for Occupational Therapy')
DSSurvey %>%
filter(!is.na(income)) %>%
filter(!is.na(DSeducation)) %>%
ggplot(aes(x = DSeducation, y = income, color = therapy_feeding)) +
geom_point() +
geom_jitter() +
ggtitle('DS Education vs income for Feeding Therapy')
DSSurvey %>%
filter(!is.na(income)) %>%
filter(!is.na(DSeducation)) %>%
ggplot(aes(x = DSeducation, y = income, color = therapy_speech)) +
geom_point() +
geom_jitter() +
ggtitle('DS Education vs income for Speech Therapy')
DSSurvey %>%
filter(!is.na(income)) %>%
filter(!is.na(DSeducation)) %>%
ggplot(aes(x = DSeducation, y = income, color = therapy_music)) +
geom_point() +
geom_jitter() +
ggtitle('DS Education vs income for Music Therapy')
# Clinic Distance vs Frequency of Clinic Visits against income
DSSurvey %>%
filter(!is.na(clinicdistance)) %>%
ggplot(aes(x = DSvisit, y = clinicdistance, color = DSage)) +
geom_point() +
geom_jitter() +
ggtitle('Distance from Clinic vs Frequency of Visits') +
facet_wrap(~income)
# Clinic Distance vs Frequency of Clinic Visits with Curve
DSSurvey %>%
group_by(clinicdistance, DSvisit) %>%
summarize(n = n()) %>%
filter(!is.na(clinicdistance)) %>%
ggplot(aes(x = clinicdistance, y = DSvisit, color = n)) +
geom_point() +
geom_jitter() +
geom_smooth(aes(x = as.numeric(clinicdistance), y = as.numeric(DSvisit), weight = n)) +
ggtitle('Distance from Clinic vs Frequency of Visits')
#DS Education vs Frequency of Clinic Visits
DSSurvey %>%
#filter(!is.na(DSeducation)) %>%
ggplot(aes(x = DSage, y = DSeducation, color = DSvisit)) +
geom_point(na.rm = TRUE) +
geom_jitter() +
ggtitle('DSeducation vs DSvisit')
# Clinic attendance vs State vs. Distance travelled
DSSurvey %>%
filter(!is.na(clinicdistance)) %>%
ggplot(aes(x = clinicdistance, y = state, color = DSvisit)) +
geom_point(na.rm = TRUE, size = 1) +
geom_jitter() +
ggtitle('Clinic attendance vs State vs. Distance travelled')
DSSurvey %>%
select(contains('concern')) %>%
summary()
# Age and Gender vs Regression types
DSSurvey %>%
filter(!is.na(regress)) %>%
filter(!is.na(gender_DS)) %>%
ggplot(aes(x = gender_DS, y = DSage, color = regress)) +
geom_point(na.rm = TRUE, size = 1) +
geom_jitter() +
ggtitle('gender vs age vs. did they regress')
DSSurvey %>%
filter(!is.na(regress_cat)) %>%
filter(!is.na(gender_DS)) %>%
ggplot(aes(x = gender_DS, y = DSage, color = regress_cat)) +
geom_point(na.rm = TRUE, size = 1) +
geom_jitter() +
ggtitle('gender vs age vs. did they regress (CAT)')
DSSurvey %>%
filter(!is.na(regress_dress)) %>%
filter(!is.na(gender_DS)) %>%
ggplot(aes(x = gender_DS, y = DSage, color = regress_dress)) +
geom_point(na.rm = TRUE, size = 1) +
geom_jitter() +
ggtitle('gender vs age vs. did they regress (DRESS)')
DSSurvey %>%
filter(!is.na(regress_attend)) %>%
filter(!is.na(gender_DS)) %>%
ggplot(aes(x = gender_DS, y = DSage, color = regress_attend)) +
geom_point(na.rm = TRUE, size = 1) +
geom_jitter() +
ggtitle('gender vs age vs. did they regress (ATTEND)')
DSSurvey %>%
filter(!is.na(regress_RW)) %>%
filter(!is.na(gender_DS)) %>%
ggplot(aes(x = gender_DS, y = DSage, color = regress_RW)) +
geom_point(na.rm = TRUE, size = 1) +
geom_jitter() +
ggtitle('gender vs age vs. did they regress (RW)')
DSSurvey %>%
filter(!is.na(regress_social)) %>%
filter(!is.na(gender_DS)) %>%
ggplot(aes(x = gender_DS, y = DSage, color = regress_social)) +
geom_point(na.rm = TRUE, size = 1) +
geom_jitter() +
ggtitle('gender vs age vs. did they regress (SOCIAL)')
DSSurvey %>%
filter(!is.na(regress_dress)) %>%
filter(!is.na(gender_DS)) %>%
ggplot(aes(x = gender_DS, y = DSage, color = regress_dress)) +
geom_point(na.rm = TRUE, size = 1) +
geom_jitter() +
ggtitle('gender vs age vs. did they regress (DRESS)')
DSSurvey %>%
filter(!is.na(regress_selfcare)) %>%
filter(!is.na(gender_DS)) %>%
ggplot(aes(x = gender_DS, y = DSage, color = regress_selfcare)) +
geom_point(na.rm = TRUE, size = 1) +
geom_jitter() +
ggtitle('gender vs age vs. did they regress (SELFCARE)')
DSSurvey %>%
filter(!is.na(regress_dress)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_dress)) +
geom_point(na.rm = TRUE, size = 1) +
geom_jitter() +
facet_wrap(~gender_DS) +
ggtitle('Dress Regression vs. Clinic visits')
DSSurvey %>%
filter(!is.na(regress_RW)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_RW)) +
geom_point(na.rm = TRUE, size = 1) +
geom_jitter() +
facet_wrap(~gender_DS) +
ggtitle('Reading and Writing Regression vs. Clinic visits')
DSSurvey %>%
filter(!is.na(regress_social)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_social)) +
geom_point(na.rm = TRUE, size = 1) +
geom_jitter() +
facet_wrap(~gender_DS) +
ggtitle('Social Regression vs. Clinic visits')
DSSurvey %>%
filter(!is.na(regress_attend)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_attend)) +
geom_point(na.rm = TRUE, size = 1) +
geom_jitter() +
facet_wrap(~gender_DS) +
ggtitle('Attend a day program Regression vs. Clinic visits')
DSSurvey %>%
filter(!is.na(regress_selfcare)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_selfcare)) +
geom_point(na.rm = TRUE, size = 1) +
geom_jitter() +
facet_wrap(~gender_DS) +
ggtitle('Self care Regression vs. Clinic visits')
DSSurvey %>%
filter(!is.na(regress_cat)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_cat)) +
geom_point(na.rm = TRUE, size = 1) +
geom_jitter() +
facet_wrap(~gender_DS) +
ggtitle('Catatonia Regression vs. Clinic visits')
DSSurvey %>%
filter(!is.na(regress_dress)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_dress)) +
geom_point(na.rm = TRUE, size = 1) +
facet_wrap(~health_apnea) +
ggtitle('Dress Regression vs. Clinic visits vs. Sleep apnea')
DSSurvey %>%
filter(!is.na(regress_RW)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_RW)) +
geom_point(na.rm = TRUE, size = 1) +
facet_wrap(~health_apnea) +
ggtitle('Reading and Writing Regression vs. Clinic visits vs. Sleep apnea')
DSSurvey %>%
filter(!is.na(regress_social)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_social)) +
geom_point(na.rm = TRUE, size = 1) +
facet_wrap(~health_apnea) +
ggtitle('Social Regression vs. Clinic visits vs. Sleep apnea')
DSSurvey %>%
filter(!is.na(regress_attend)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_attend)) +
geom_point(na.rm = TRUE, size = 1) +
facet_wrap(~health_apnea) +
ggtitle('Attend a day program Regression vs. Clinic visits vs. Sleep apnea')
DSSurvey %>%
filter(!is.na(regress_selfcare)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_selfcare)) +
geom_point(na.rm = TRUE, size = 1) +
facet_wrap(~health_apnea) +
ggtitle('Self care Regression vs. Clinic visits vs. Sleep apnea')
DSSurvey %>%
filter(!is.na(regress_cat)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_cat)) +
geom_point(na.rm = TRUE, size = 1) +
facet_wrap(~health_apnea) +
ggtitle('Catatonia Regression vs. Clinic visits vs. Sleep apnea')
DSSurvey %>%
filter(!is.na(regress_dress)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_dress)) +
geom_point(na.rm = TRUE, size = 1) +
geom_jitter() +
facet_wrap(~gender_DS) +
ggtitle('Dress Regression vs. Clinic visits')
DSSurvey %>%
filter(!is.na(regress_RW)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_RW)) +
geom_point(na.rm = TRUE, size = 1) +
geom_jitter() +
facet_wrap(~gender_DS) +
ggtitle('Reading and Writing Regression vs. Clinic visits')
DSSurvey %>%
filter(!is.na(regress_social)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_social)) +
geom_point(na.rm = TRUE, size = 1) +
geom_jitter() +
facet_wrap(~gender_DS) +
ggtitle('Social Regression vs. Clinic visits')
DSSurvey %>%
filter(!is.na(regress_attend)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_attend)) +
geom_point(na.rm = TRUE, size = 1) +
geom_jitter() +
facet_wrap(~gender_DS) +
ggtitle('Attend a day program Regression vs. Clinic visits')
DSSurvey %>%
filter(!is.na(regress_selfcare)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_selfcare)) +
geom_point(na.rm = TRUE, size = 1) +
geom_jitter() +
facet_wrap(~gender_DS) +
ggtitle('Self care Regression vs. Clinic visits')
DSSurvey %>%
filter(!is.na(regress_cat)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_cat)) +
geom_point(na.rm = TRUE, size = 1) +
geom_jitter() +
facet_wrap(~gender_DS) +
ggtitle('Catatonia Regression vs. Clinic visits')
DSSurvey %>%
filter(!is.na(regress_dress)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_dress)) +
geom_point(na.rm = TRUE, size = 1) +
facet_wrap(~health_apnea) +
ggtitle('Dress Regression vs. Clinic visits vs. Sleep apnea')
DSSurvey %>%
filter(!is.na(regress_RW)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_RW)) +
geom_point(na.rm = TRUE, size = 1) +
facet_wrap(~health_apnea) +
ggtitle('Reading and Writing Regression vs. Clinic visits vs. Sleep apnea')
DSSurvey %>%
filter(!is.na(regress_social)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_social)) +
geom_point(na.rm = TRUE, size = 1) +
facet_wrap(~health_apnea) +
ggtitle('Social Regression vs. Clinic visits vs. Sleep apnea')
DSSurvey %>%
filter(!is.na(regress_attend)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_attend)) +
geom_point(na.rm = TRUE, size = 1) +
facet_wrap(~health_apnea) +
ggtitle('Attend a day program Regression vs. Clinic visits vs. Sleep apnea')
DSSurvey %>%
filter(!is.na(regress_selfcare)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_selfcare)) +
geom_point(na.rm = TRUE, size = 1) +
facet_wrap(~health_apnea) +
ggtitle('Self care Regression vs. Clinic visits vs. Sleep apnea')
DSSurvey %>%
filter(!is.na(regress_cat)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress_cat)) +
geom_point(na.rm = TRUE, size = 1) +
facet_wrap(~health_apnea) +
ggtitle('Catatonia Regression vs. Clinic visits vs. Sleep apnea')
DSSurvey %>%
filter(!is.na(regress)) %>%
ggplot(aes(x = DSvisit, y = DSage, color = regress)) +
geom_point(na.rm = TRUE, size = 1) +
facet_wrap(~health_apnea) +
ggtitle('Regression vs. Clinic visits vs. Sleep apnea')
# Boxplot Regression vs. Sleep apnea
ggplot(DSSurvey, aes(x=as.factor(regress), y=DSage)) +
geom_boxplot(fill="yellow", alpha=0.2) +
facet_wrap(~health_apnea) +
xlab("Signs of Regression") +
ggtitle('Regression vs. Sleep apnea')
# How often one visits vs. age.
ggplot(DSSurvey, aes(x=as.factor(DSvisit), y=DSage)) +
geom_boxplot(fill="red", alpha=0.2) +
xlab("DSvisit")
# Barplot Dealing with income and DSvisits
ggplot(DSSurvey, aes(x=as.factor(DSvisit), fill=as.factor(income) )) +
geom_bar( )
# Example 2:
ggplot(DSSurvey, aes(x=as.factor(DSvisit), fill=as.factor(income) )) +
geom_bar( ) +
scale_fill_brewer(palette = "Set1")
# Barplot Clinic distance without NAs vs. Clinic visits
DSSurvey %>%
filter(!is.na(as.factor(clinicdistance))) %>%
ggplot(aes(x=as.factor(DSvisit), fill=as.factor(clinicdistance))) +
geom_bar( )
# Barplot Clinic distance vs. Clinic visits
ggplot(DSSurvey, aes(x=as.factor(DSvisit), fill=as.factor(clinicdistance) )) +
geom_bar( )
# Failed attempt at Density Plot
library(ggplot2)
ggplot(aes(as.numeric(DSage), colour=regress_selfcare, fill=regress_selfcare)) +
subset(DSSurvey, regress_selfcare & ! is.na(as.numeric(DSage))) +
geom_density(alpha=0.55)