-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
512 lines (512 loc) · 37.2 KB
/
.Rhistory
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
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
model = "random",
data = NLSY_Valid_Childcare_Part_Time_2)
pooled.part_time_all_formal <- plm(INCOME_LOG ~ FORMAL_CHILDCARE +N_CHILDREN+ MARRIED_OR_COHABITATING + BA_ABOVE +
SPOUSAL_INCOME_LOG + MOTHER_AGE_FIRST_CHILD +
as.factor(YEAR),
index = c("PUBID_1997", "YEAR"),
model = "pooling",
data = NLSY_Valid_Childcare_Part_Time_2)
stargazer(fe.part_time_all_formal,pooled.part_time_all_formal,
title="Regression Results",
align=TRUE,
dep.var.labels=c("Income"),
no.space=TRUE,
column.labels=c("Fixed Effects", "Pooled"),
dep.var.caption="",
model.numbers=FALSE,
# type = "latex",
type = "text",
omit = "Constant")
fe.all <- plm(INCOME_LOG ~ FAMILY_CARE + N_CHILDREN + MARRIED_OR_COHABITATING + BA_ABOVE + SPOUSAL_INCOME_LOG + as.factor(YEAR),
index = c("PUBID_1997", "YEAR"), # id & time variables
model = "within",
data = NLSY_Valid_Childcare_Income_One_Child)
summary(fe.all)
pooled.all <- plm(INCOME_LOG ~ FAMILY_CARE + N_CHILDREN + MARRIED_OR_COHABITATING + BA_ABOVE + MOTHER_AGE_FIRST_CHILD + SPOUSAL_INCOME_LOG + as.factor(YEAR),
index = c("PUBID_1997", "YEAR"),
model = "pooling",
data = NLSY_Valid_Childcare_Income_One_Child) ## this is equivalent to above OLS ##
summary(pooled.all)
stargazer(fe.all,pooled.all,
title="Regression Results",
align=TRUE,
dep.var.labels=c("Income"),
no.space=TRUE,
column.labels=c("Fixed Effects"),
dep.var.caption="",
model.numbers=FALSE,
# type = "latex",
type = "text",
omit = "Constant")
stargazer(fe.all,pooled.all,
title="Regression Results",
align=TRUE,
dep.var.labels=c("Income"),
no.space=TRUE,
column.labels=c("Fixed Effects","Pooled"),
dep.var.caption="",
model.numbers=FALSE,
# type = "latex",
type = "text",
omit = "Constant")
NLSY_Valid_Childcare_Income_One_Child <- NLSY_Valid_Childcare_Income_One_Child %>% arrange(PUBID_1997,YEAR) %>% group_by(PUBID_1997) %>%
mutate(changed_to_relative = ifelse(lag(FAMILY_CARE) == 0 & FAMILY_CARE == 1, 1, 0)) %>% mutate(ever_changed_to_relative = max(changed_to_relative)) %>% mutate(changed_to_formal = ifelse(lag(FORMAL_CHILDCARE)==0 & FORMAL_CHILDCARE==1, 1, 0)) %>% mutate(ever_changed_to_formal = max(changed_to_formal))
NLSY_Valid_Childcare_Part_Time_One_Child <- NLSY_Valid_Childcare_Part_Time_One_Child %>% arrange(PUBID_1997,YEAR) %>% group_by(PUBID_1997) %>%
mutate(changed_to_relative = ifelse(lag(FAMILY_CARE) == 0 & FAMILY_CARE == 1, 1, 0)) %>% mutate(ever_changed_to_relative = max(changed_to_relative)) %>% mutate(changed_to_formal = ifelse(lag(FORMAL_CHILDCARE)==0 & FORMAL_CHILDCARE==1, 1, 0)) %>% mutate(ever_changed_to_formal = max(changed_to_formal))
describe(NLSY_Valid_Childcare_Part_Time_One_Child %>% select(PUBID_1997,MATERNAL_AGE,CV_HGC_EVER_EDT,CV_INCOME_FAMILY,WORK_EDU_HRS,ever_changed_to_relative,INCOME) %>% subset(ever_changed_to_relative == 1))
describe(NLSY_Valid_Childcare_Part_Time_One_Child %>% select(PUBID_1997,MATERNAL_AGE,CV_HGC_EVER_EDT,CV_INCOME_FAMILY,WORK_EDU_HRS,ever_changed_to_relative,INCOME) %>% subset(ever_changed_to_relative == 0))
psych::describe(NLSY_Valid_Childcare_Part_Time_One_Child %>% select(PUBID_1997,MATERNAL_AGE,CV_HGC_EVER_EDT,CV_INCOME_FAMILY,WORK_EDU_HRS,ever_changed_to_formal,INCOME) %>% subset(ever_changed_to_formal == 1))
psych::describe(NLSY_Valid_Childcare_Part_Time_One_Child %>% select(PUBID_1997,MATERNAL_AGE,CV_HGC_EVER_EDT,CV_INCOME_FAMILY,WORK_EDU_HRS,ever_changed_to_formal,ever_changed_to_relative,INCOME) %>% subset(ever_changed_to_formal == 0 & ever_changed_to_relative == 0))
rcorr(as.matrix(NLSY_Valid_Childcare_Part_Time_2%>% select(CV_HGC_EVER_EDT,WORK_EDU_HRS,MARRIED_OR_COHABITATING, MOTHER_AGE_FIRST_CHILD,INCOME,SPOUSAL_INCOME,FAMILY_CARE,FORMAL_CHILDCARE,N_CHILDREN)),type="pearson")
# -- Changes made in childcare mode - ---------------------
## -----------------------------------------------------------------------------------------------------------------------------------
# Any income women with one child
NLSY_Valid_Childcare_Income_One_Child <- NLSY_Valid_Childcare_Income_One_Child %>% arrange(PUBID_1997,YEAR) %>% group_by(PUBID_1997) %>%
mutate(changed_to_relative = ifelse(lag(FAMILY_CARE) == 0 & FAMILY_CARE == 1, 1, 0)) %>% mutate(ever_changed_to_relative = max(changed_to_relative)) %>% mutate(changed_to_formal = ifelse(lag(FORMAL_CHILDCARE)==0 & FORMAL_CHILDCARE==1, 1, 0)) %>% mutate(ever_changed_to_formal = max(changed_to_formal))
# Part time women with one child
NLSY_Valid_Childcare_Part_Time_One_Child <- NLSY_Valid_Childcare_Part_Time_One_Child %>% arrange(PUBID_1997,YEAR) %>% group_by(PUBID_1997) %>%
mutate(changed_to_relative = ifelse(lag(FAMILY_CARE) == 0 & FAMILY_CARE == 1, 1, 0)) %>% mutate(ever_changed_to_relative = max(changed_to_relative)) %>% mutate(changed_to_formal = ifelse(lag(FORMAL_CHILDCARE)==0 & FORMAL_CHILDCARE==1, 1, 0)) %>% mutate(ever_changed_to_formal = max(changed_to_formal))
# Descriptive statistics for changing childcare modes
psych::describe(NLSY_Valid_Childcare_Part_Time_One_Child %>% select(PUBID_1997,MATERNAL_AGE,CV_HGC_EVER_EDT,CV_INCOME_FAMILY,WORK_EDU_HRS,ever_changed_to_relative,INCOME) %>% subset(ever_changed_to_relative == 1))
## ----valid_childcare_pearson, eval=TRUE, echo=TRUE, message=FALSE, warning=FALSE,column.sep.width = "1pt",comment=NA,font.size=8-----------
rcorr(as.matrix(NLSY_Valid_Childcare_Part_Time_2%>% select(CV_HGC_EVER_EDT,WORK_EDU_HRS,MARRIED_OR_COHABITATING, MOTHER_AGE_FIRST_CHILD,INCOME,SPOUSAL_INCOME,FAMILY_CARE,FORMAL_CHILDCARE,N_CHILDREN)),type="pearson")
fe.part_time_full <- plm(INCOME_LOG ~ FAMILY_CARE + MARRIED_OR_COHABITATING + BA_ABOVE + SPOUSAL_INCOME_LOG + as.factor(YEAR),
index = c("PUBID_1997", "YEAR"), # id & time variables
model = "within",
data = NLSY_Valid_Childcare_Part_Time_One_Child)
NLSY_Valid_Childcare_Part_Time_One_Child %>% select(FAMILY_CARE,RELATIVE_CARE,INCOME_LOG)
summary(fe.part_time_full)
fe.part_time_full <- plm(INCOME_LOG ~ FAMILY_CARE + MARRIED_OR_COHABITATING + BA_ABOVE + SPOUSAL_INCOME_LOG + as.factor(YEAR),
index = c("PUBID_1997", "YEAR"), # id & time variables
model = "within",
data = NLSY_Valid_Childcare_Part_Time_One_Child)
summary(fe.part_time_full)
source("~/QMSS/Intergenerational_Childcare_Maternal_Wage_Gap/code/results/final_results.Rmd")
source("~/QMSS/Intergenerational_Childcare_Maternal_Wage_Gap/code/results/final_results.Rmd")
source("~/QMSS/Intergenerational_Childcare_Maternal_Wage_Gap/code/results/final_results.Rmd")
psych::describe(NLSY_Valid_Childcare_Part_Time_One_Child %>% select(INCOME, MARRIED_OR_COHABITATING, BA_ABOVE,SPOUSAL_INCOME, MOTHER_AGE_FIRST_CHILD, MATERNAL_AGE,`YCCAL-6800`,FAMILY_CARE, N_CHILDREN,FULL_TIME,Relative_within_15_minutes))
load("~/QMSS/Intergenerational_Childcare_Maternal_Wage_Gap/data/NLSY_imputed_first_child.RData")
NLSY_Valid <- NLSY_imputed %>%
filter(CV_HGC_EVER_EDT != 95 & !is.na(CV_HGC_EVER_EDT)) %>%
filter(CV_HGC_EVER_EDT >= 12)
dt <- psych::describe(NLSY_Valid %>% select(INCOME,FAMILY_CARE,`YCCAL-6800`,BA_ABOVE,N_CHILDREN,MARRIED_OR_COHABITATING,SPOUSAL_INCOME,MATERNAL_AGE, N_CHILDREN))
dt
load("~/QMSS/Intergenerational_Childcare_Maternal_Wage_Gap/data/NLSY_imputed.RData")
NLSY_Valid_Childcare_2 <- Valid_Childcare(NLSY_imputed,FALSE)
p4 <- NLSY_Valid_Childcare_2 %>% dplyr::select(PUBID_1997,YEAR,INCOME,PART_TIME,`FAMILY_CARE`,`RELATIVE_CARE`,WORK_EDU_HRS,CV_BIO_CHILD_HH) %>% subset(YEAR>=2005) %>% subset(INCOME>0) %>% subset(CV_BIO_CHILD_HH>0) %>%
subset(PART_TIME ==1) %>% dplyr::mutate(FAMILY_CARE_CAT = ifelse(`WORK_EDU_HRS`==0, 'No (Mother Provides Childcare)',ifelse(`FAMILY_CARE`==1,'Yes',ifelse(FAMILY_CARE==0,'No (Other Childcare)',NaN)))) %>% dplyr::group_by(YEAR,FAMILY_CARE_CAT) %>% dplyr::mutate(FAMILY_CARE_CAT_proportion = n()) %>% ungroup() %>% dplyr::group_by(YEAR,FAMILY_CARE_CAT, FAMILY_CARE_CAT_proportion) %>% dplyr::summarize() %>%
ggplot(aes(x = YEAR, y = FAMILY_CARE_CAT_proportion)) +
geom_bar(stat="identity",aes(fill = FAMILY_CARE_CAT)) +
theme_ipsum(base_size = 12, axis_title_size = 14) +
scale_fill_manual(values=c("#ff6f00", "#008fa0")) +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
labs(title = '', color = 'Response') +
labs(fill = "Primary Child Care Method is Relative-provided Care",
y="Count", x = "", title = "Intergenerational Childcare (First Child Only,\n 6 and under,\n Part Time Work )")
p4
#ggplotly(p4)
NLSY_imputed$`YCCA-450`<- as.numeric(NLSY_imputed$`YCCA-450`)
NLSY_imputed$`YCCAL-450`<- as.numeric(NLSY_imputed$`YCCAL-450`)
NLSY_imputed_FAMILY_CARE_CAT <- NLSY_imputed %>% subset(!is.na(`YCCAL-1100A~000002`))
NLSY_imputed_FAMILY_CARE_CAT$YEAR <- as.numeric(NLSY_imputed_FAMILY_CARE_CAT$YEAR)
NLSY_imputed_FAMILY_CARE_CAT$`YCCAL-6800`[is.na(NLSY_imputed_FAMILY_CARE_CAT$`YCCAL-6800`)] <- 'NA'
p5 <- NLSY_imputed_FAMILY_CARE_CAT %>% dplyr::select(PUBID_1997,YEAR,`YCCAL-6800`,CV_HH_UNDER_6,CV_BIO_CHILD_HH,INCOME,CV_ENROLLSTAT_EDT,`YCCA-450`,`YCCAL-450`,FAMILY_CARE) %>% subset(CV_HH_UNDER_6>0 & CV_BIO_CHILD_HH>0) %>%
subset(INCOME>0) %>%
dplyr::mutate(relative_15 = ifelse(`YCCAL-6800`==1, 'Yes',ifelse(`YCCAL-6800`==0,'No','NaN'))) %>% dplyr::group_by(YEAR,relative_15) %>% dplyr::mutate(relative_15_proportion = n()) %>% ungroup() %>% dplyr::group_by(YEAR,relative_15, relative_15_proportion) %>% dplyr::summarize() %>%
ggplot(aes(x = YEAR, y = relative_15_proportion)) +
geom_bar(stat="identity",aes(fill = relative_15)) +
theme_ipsum(base_size = 12, axis_title_size = 14) +
scale_fill_futurama(alpha = 0.75) +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
labs(title = , color = 'Response') +
labs(fill = "Relative 15 Miles Away??", y="Count", x = "")
p5
#ggplotly(p5)
NLSY_imputed_FAMILY_CARE_CAT %>% dplyr::select(PUBID_1997,YEAR,`YCCAL-6800`,CV_HH_UNDER_6,CV_BIO_CHILD_HH,INCOME,CV_ENROLLSTAT_EDT,`YCCA-450`,`YCCAL-450`,FAMILY_CARE,RELATIVE_CARE,SIBLING_CARE,`YCCAL-1100A~000002`,FAMILY_DAY_CARE,WORK_EDU_HRS) %>% subset(CV_HH_UNDER_6>0 & CV_BIO_CHILD_HH>0) %>%
subset(INCOME>0) %>%
# dplyr::mutate(FAMILY_CARE_CAT = ifelse(`WORK_EDU_HRS`==0, 'No (Mother Provides Childcare)',ifelse(`FAMILY_CARE`==1,'Yes',ifelse(FAMILY_CARE==0,'No (Other Childcare)',NaN)))) %>%
dplyr::mutate(relative_15 = ifelse(`YCCAL-6800`==1, 'Yes',ifelse(`YCCAL-6800`==0,'No','NA'))) %>%
group_by(YEAR) %>% dplyr::mutate(year_count = n()) %>% ungroup() %>%
dplyr::group_by(YEAR,relative_15) %>% dplyr::mutate(relative_15_proportion = n()/year_count) %>%
ungroup() %>%
#subset(relative_15 == 'Yes') %>%
dplyr::group_by(YEAR, relative_15, relative_15_proportion) %>% dplyr::summarize() %>%
ggplot(aes(x = YEAR, y = relative_15_proportion)) +
geom_point(aes(color = relative_15))+
geom_line(stat="identity",aes(color = relative_15, linetype = relative_15)) +
theme_ipsum(base_size = 12, axis_title_size = 14) +
scale_color_futurama(alpha = 0.75) +
scale_x_continuous(limits=c(2005,2008,2011,2015)) +
labs(title = "NLSY Panel Proportions:\nANY RELATIVES LIVE WITHIN 15 MINUTES OF CHILD'S HOME?",
y="Proportion", x = "",linetype = "Relative-Provided Childcare",color="Relative-Provided Childcare")
library(Hmisc)
NLSY_Valid_Childcare_Part_Time_One_Child = NLSY_Valid_Childcare_Part_Time_One_Child %>% filter(!is.na(`YCCAL-6800`))
rcorr(as.matrix(NLSY_Valid_Childcare_Part_Time_One_Child %>% select(`YCCAL-6800`,FAMILY_CARE)),type="pearson")
rcorr(as.matrix(NLSY_Valid_Childcare_Part_Time_One_Child %>% select(`YCCAL-6800`,FAMILY_CARE)),type="pearson")
NLSY_imputed$`YCCA-450`<- as.numeric(NLSY_imputed$`YCCA-450`)
NLSY_imputed$`YCCAL-450`<- as.numeric(NLSY_imputed$`YCCAL-450`)
NLSY_imputed_FAMILY_CARE_CAT <- NLSY_imputed %>% subset(!is.na(`YCCAL-1100A~000002`))
NLSY_imputed_FAMILY_CARE_CAT$YEAR <- as.numeric(NLSY_imputed_FAMILY_CARE_CAT$YEAR)
NLSY_imputed_FAMILY_CARE_CAT$`YCCAL-6800`[is.na(NLSY_imputed_FAMILY_CARE_CAT$`YCCAL-6800`)] <- 'NA'
p5 <- NLSY_imputed_FAMILY_CARE_CAT %>% dplyr::select(PUBID_1997,YEAR,`YCCAL-6800`,CV_HH_UNDER_6,CV_BIO_CHILD_HH,INCOME,CV_ENROLLSTAT_EDT,`YCCA-450`,`YCCAL-450`,FAMILY_CARE) %>% subset(CV_HH_UNDER_6>0 & CV_BIO_CHILD_HH>0) %>%
subset(INCOME>0) %>%
dplyr::mutate(relative_15 = ifelse(`YCCAL-6800`==1, 'Yes',ifelse(`YCCAL-6800`==0,'No','NaN'))) %>% dplyr::group_by(YEAR,relative_15) %>% dplyr::mutate(relative_15_proportion = n()) %>% ungroup() %>% dplyr::group_by(YEAR,relative_15, relative_15_proportion) %>% dplyr::summarize() %>%
ggplot(aes(x = YEAR, y = relative_15_proportion)) +
geom_bar(stat="identity",aes(fill = relative_15)) +
theme_ipsum(base_size = 12, axis_title_size = 14) +
scale_fill_futurama(alpha = 0.75) +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
labs(title = , color = 'Response') +
labs(fill = "Relative 15 Miles Away??", y="Count", x = "")
p5
#ggplotly(p5)
NLSY_imputed_FAMILY_CARE_CAT %>% dplyr::select(PUBID_1997,YEAR,`YCCAL-6800`,CV_HH_UNDER_6,CV_BIO_CHILD_HH,INCOME,CV_ENROLLSTAT_EDT,`YCCA-450`,`YCCAL-450`,FAMILY_CARE,RELATIVE_CARE,SIBLING_CARE,`YCCAL-1100A~000002`,FAMILY_DAY_CARE,WORK_EDU_HRS) %>% subset(CV_HH_UNDER_6>0 & CV_BIO_CHILD_HH>0) %>%
subset(INCOME>0) %>%
# dplyr::mutate(FAMILY_CARE_CAT = ifelse(`WORK_EDU_HRS`==0, 'No (Mother Provides Childcare)',ifelse(`FAMILY_CARE`==1,'Yes',ifelse(FAMILY_CARE==0,'No (Other Childcare)',NaN)))) %>%
dplyr::mutate(relative_15 = ifelse(`YCCAL-6800`==1, 'Yes',ifelse(`YCCAL-6800`==0,'No','NA'))) %>%
group_by(YEAR) %>% dplyr::mutate(year_count = n()) %>% ungroup() %>%
dplyr::group_by(YEAR,relative_15) %>% dplyr::mutate(relative_15_proportion = n()/year_count) %>%
ungroup() %>%
#subset(relative_15 == 'Yes') %>%
dplyr::group_by(YEAR, relative_15, relative_15_proportion) %>% dplyr::summarize() %>%
ggplot(aes(x = YEAR, y = relative_15_proportion)) +
geom_point(aes(color = relative_15))+
geom_line(stat="identity",aes(color = relative_15, linetype = relative_15)) +
theme_ipsum(base_size = 12, axis_title_size = 14) +
scale_color_futurama(alpha = 0.75) +
scale_x_continuous(limits=c(2005,2008,2011,2015)) +
labs(title = "NLSY Panel Proportions:\nANY RELATIVES LIVE WITHIN 15 MINUTES OF CHILD'S HOME?",
y="Proportion", x = "",linetype = "Relative-Provided Childcare",color="Relative-Provided Childcare")
load("~/QMSS/Intergenerational_Childcare_Maternal_Wage_Gap/data/NLSY_imputed_first_child.RData")
NLSY_Valid_Childcare_1 <- Valid_Childcare(NLSY_imputed,TRUE)
NLSY_imputed <- NLSY_imputed[!is.na(NLSY_imputed$WORK_EDU_HRS),]
# This is just with everyone with any biological children in the household; it appears here that we don't have a lot of present data.
p1 <- NLSY_imputed %>% dplyr::select(PUBID_1997,YEAR,BIOCHILD_6_YR,INCOME,`YCCAL-1100A~000002`,`YCCA-1100A~000002`,`FAMILY_CARE`,`RELATIVE_CARE`,WORK_EDU_HRS,CV_BIO_CHILD_HH) %>% subset(YEAR>=2005) %>% subset(INCOME>0) %>% subset(CV_BIO_CHILD_HH>0) %>% plyr::mutate(FAMILY_CARE_CAT = ifelse(`WORK_EDU_HRS`==0, 'No (Mother Provides Childcare)',ifelse(`FAMILY_CARE`==1,'Yes',ifelse(FAMILY_CARE==0,'No (Other Childcare)',NaN)))) %>% dplyr::group_by(YEAR,FAMILY_CARE_CAT) %>% dplyr::mutate(FAMILY_CARE_CAT_proportion = n()) %>% ungroup() %>% dplyr::group_by(YEAR,FAMILY_CARE_CAT, FAMILY_CARE_CAT_proportion) %>% dplyr::summarize() %>%
ggplot(aes(x = YEAR, y = FAMILY_CARE_CAT_proportion)) +
geom_bar(stat="identity",aes(fill = FAMILY_CARE_CAT)) +
theme_ipsum(base_size = 12, axis_title_size = 14) +
scale_fill_futurama(alpha = 0.75) +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
labs(title = '', color = 'Response') +
labs(fill = "Primary Child Care Method is Relative-provided Care",
y="Count", x = "", title = "Relative-provided Childcare (Any child under 6)")
p1
ggplotly(p1)
NLSY_imputed_FAMILY_CARE_CAT <- NLSY_imputed_FAMILY_CARE_CAT %>% subset(!is.na(`YCCAL-6800`)) %>% subset(`YCCAL-6800`!='NA')
NLSY_imputed_FAMILY_CARE_CAT <- NLSY_imputed_FAMILY_CARE_CAT %>% subset(!is.na(FAMILY_CARE))
unique(NLSY_imputed_FAMILY_CARE_CAT$`YCCAL-6800`)
NLSY_imputed_FAMILY_CARE_CAT %>% dplyr::select(PUBID_1997,YEAR,`YCCAL-6800`,CV_HH_UNDER_6,CV_BIO_CHILD_HH,INCOME,CV_ENROLLSTAT_EDT,`YCCA-450`,`YCCAL-450`,FAMILY_CARE) %>% subset(CV_HH_UNDER_6>0 & CV_BIO_CHILD_HH>0) %>%
#subset(`YCCAL-450`!=0) %>%
dplyr::mutate(relative_15 = ifelse(`YCCAL-6800`==1, 'Yes',ifelse(`YCCAL-6800`==0,'No','NaN'))) %>%
dplyr::mutate(FAMILY_CARE_CAT = ifelse(`FAMILY_CARE`==0, 'No',ifelse(`FAMILY_CARE`==1,'Yes','NaN'))) %>%
dplyr::group_by(relative_15,FAMILY_CARE) %>%
dplyr::mutate(FAMILY_CARE_count = n()) %>% ungroup() %>%
mutate(perc=100*FAMILY_CARE_count/nrow(NLSY_imputed_FAMILY_CARE_CAT)) %>%
dplyr::group_by(relative_15, FAMILY_CARE_CAT,FAMILY_CARE_count,perc) %>%
dplyr::summarize() %>%
ggplot(aes(x = relative_15, y = perc)) +
geom_bar(stat="identity",aes(fill = FAMILY_CARE_CAT),position = "dodge") +
theme_ipsum(base_size = 12, axis_title_size = 14) +
scale_fill_manual(values=c("#ff6f00", "#008fa0")) +
theme(
axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
labs(title = , color = 'Response') +
labs(fill = "Relative Care is a primary source of childcare?", y="Percent of Data", x = "Relative is within 15 Miles?")
NLSY_Valid_Childcare_1 %>% dplyr::select(PUBID_1997,YEAR,CV_BIO_CHILD_HH,CHILDCARE_TYPE) %>% subset(YEAR>2005) %>%
subset(CV_BIO_CHILD_HH==1) %>%
dplyr::group_by(YEAR) %>% mutate(Total_Year = n()) %>% ungroup() %>%
group_by(YEAR,CHILDCARE_TYPE) %>% dplyr::mutate(CHILDCARE_TYPE_COUNT = n()/Total_Year) %>% ungroup() %>% dplyr::group_by(YEAR,CHILDCARE_TYPE, CHILDCARE_TYPE_COUNT) %>% dplyr::summarize() %>%
ggplot(aes(x = YEAR, y = CHILDCARE_TYPE_COUNT)) +
geom_point(stat="identity",aes(color = CHILDCARE_TYPE)) +
geom_line(stat="identity",aes(color = CHILDCARE_TYPE, linetype = CHILDCARE_TYPE)) +
theme_ipsum(base_size = 12, axis_title_size = 14) +
#scale_fill_manual(values=c("#C9473B", "#75A1AD")) +
scale_color_futurama(alpha = 0.75) +
theme(
axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
labs(title = '', color = 'Response') +
scale_x_continuous(limits=c(2010,2015)) +
labs(linetype = "Type of Childcare", color = "Type of Childcare",
y="Proportion of Mothers in Wave*", x = "", title = "Primary Source of Childcare",
caption = "*Each year's aggregated group includes mothers whose first-born child is under 6 years of age.")
NLSY_Valid_Childcare_Income_One_Child %>% dplyr::select(PUBID_1997,YEAR,CV_BIO_CHILD_HH,SPOUSAL_CHILDCARE,FORMAL_CHILDCARE,WORK_EDU_HRS,FAMILY_CARE) %>% subset(YEAR>2005) %>%
dplyr::group_by(YEAR) %>% mutate(Total_Year = n()) %>% ungroup() %>% dplyr::mutate(FAMILY_CARE_CAT = ifelse(`WORK_EDU_HRS`==0, 'Mother Provides Childcare',ifelse(`FAMILY_CARE`==1 & FORMAL_CHILDCARE==1, 'Z Family and Formal',ifelse(`FAMILY_CARE`==1,'Family Provided Childcare',ifelse(FORMAL_CHILDCARE==1, 'Formal Childcare Options', ifelse(SPOUSAL_CHILDCARE==1, 'Spousal Childcare', 'Other Childcare Options')))))) %>%
group_by(YEAR,FAMILY_CARE_CAT) %>% dplyr::mutate(CHILDCARE_TYPE_COUNT = n()/Total_Year) %>% ungroup() %>% dplyr::group_by(YEAR,FAMILY_CARE_CAT, CHILDCARE_TYPE_COUNT) %>% dplyr::summarize() %>%
ggplot(aes(x = YEAR, y = CHILDCARE_TYPE_COUNT)) +
geom_point(stat="identity",aes(color = FAMILY_CARE_CAT)) +
geom_line(stat="identity",aes(color = FAMILY_CARE_CAT, linetype = FAMILY_CARE_CAT)) +
theme_ipsum(base_size = 12, axis_title_size = 14) +
#scale_fill_manual(values=c("#C9473B", "#75A1AD")) +
scale_color_futurama(alpha = 0.75) +
theme(
axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
labs(title = '', color = 'Response') +
scale_x_continuous(limits=c(2006,2016)) +
labs(linetype = "Primary Type of Childcare", color = "Primary Type of Childcare",
y="Proportion of Mothers in Wave*", x = "Survey Year", title = "Primary Childcare Option(s)", subtitle="(all women with ONLY one biological child)",
caption = "*Each year's aggregated group includes mothers with only one child under 6 years of age.")
mean_maternal_ages <- NLSY_Valid_Childcare_Income_One_Child %>% dplyr::select(PUBID_1997,YEAR,WORK_EDU_HRS,FAMILY_CARE,MOTHER_AGE_FIRST_CHILD,FORMAL_CHILDCARE) %>% subset(YEAR>2005) %>%
dplyr::mutate(FAMILY_CARE_CAT = ifelse(`WORK_EDU_HRS`==0, 'Mother Provides Childcare',ifelse(`FAMILY_CARE`==1,'Family Provided Childcare',ifelse(FORMAL_CHILDCARE==1, 'Formal Childcare Options', 'Other Childcare Options')))) %>%
dplyr::group_by(YEAR,FAMILY_CARE_CAT) %>% mutate(Mean_Maternal_Age = mean(MOTHER_AGE_FIRST_CHILD)) %>% ungroup() %>%
dplyr::group_by(YEAR) %>% mutate(Overall_Mean_Maternal_Age = mean(MOTHER_AGE_FIRST_CHILD)) %>% ungroup() %>%
group_by(YEAR,Mean_Maternal_Age,Overall_Mean_Maternal_Age,FAMILY_CARE_CAT) %>% dplyr::summarize()
mean_maternal_ages
mean_maternal_ages %>%
ggplot(aes(x = YEAR)) +
geom_point(stat="identity",aes(y=Mean_Maternal_Age,color = FAMILY_CARE_CAT)) +
geom_line(stat="identity",aes(y=Mean_Maternal_Age,color = FAMILY_CARE_CAT)) +
geom_point(stat="identity",aes(y=Overall_Mean_Maternal_Age), alpha = 0.5) +
geom_line(stat="identity",aes(y=Overall_Mean_Maternal_Age), linetype = 'dashed', alpha = 0.5) +
theme_ipsum(base_size = 12, axis_title_size = 14) +
scale_color_futurama(alpha = 0.75) +
theme(
axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
labs(title = '', color = 'Response') +
scale_x_continuous(limits=c(2006,2016)) +
ylim(20,33) +
labs(linetype = "Primary Type of Childcare", color = "Primary Type of Childcare",
y="Age", x = "Survey Year", title = "Average Age", subtitle = "When first child is born")
NLSY_Valid_Childcare_Income_One_Child %>% dplyr::select(PUBID_1997,YEAR,WORK_EDU_HRS,FAMILY_CARE,MOTHER_AGE_FIRST_CHILD,FORMAL_CHILDCARE) %>% subset(YEAR>2005) %>%
dplyr::mutate(FAMILY_CARE_CAT = ifelse(`WORK_EDU_HRS`==0, 'Mother Provides Childcare',ifelse(`FAMILY_CARE`==1,'Family Provided Childcare',ifelse(FORMAL_CHILDCARE==1, 'Formal Childcare Options', 'Other Childcare Options')))) %>%
ggplot(aes(x =MOTHER_AGE_FIRST_CHILD ,y=FAMILY_CARE_CAT)) +
geom_boxplot(aes(color = FAMILY_CARE_CAT))+theme_ipsum(base_size = 12, axis_title_size = 14) +
scale_color_futurama(alpha = 0.75) +
theme(
axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1),
axis.text.y=element_blank()
) +
labs(linetype = "Primary Type of Childcare", color = "Primary Type of Childcare",
y="", x = "Age", title = "Average Age", subtitle = "When first child is born")
NLSY_Valid_Childcare_Income_2 = NLSY_Valid_Childcare_Income_2[!is.na(NLSY_Valid_Childcare_Income_2$CV_INCOME_FAMILY),]
ses_care_type <- NLSY_Valid_Childcare_Income_2 %>% dplyr::select(PUBID_1997,YEAR,MARRIED_OR_COHABITATING,INCOME,WORK_EDU_HRS,CV_INCOME_FAMILY,FAMILY_CARE,MATERNAL_AGE,FORMAL_CHILDCARE) %>% subset(YEAR>2005) %>%
dplyr::mutate(SES = ifelse(
#MARRIED_OR_COHABITATING == 1, ifelse(
CV_INCOME_FAMILY < 45000,'Lower-Class',
ifelse(CV_INCOME_FAMILY < 135000, 'Middle-Class','Upper-Class'))
#,ifelse(INCOME < 15000,'Lower-Class',
# ifelse(CV_INCOME_FAMILY < 75000, 'Middle-Class','Upper-Class'))))
) %>%
dplyr::mutate(FAMILY_CARE_CAT = ifelse(`WORK_EDU_HRS`==0, 'Mother Provides Childcare',ifelse(`FAMILY_CARE`==1,'Family Provided Childcare',ifelse(FORMAL_CHILDCARE==1, 'Formal Childcare Options', 'Other Childcare Options')))) %>%
dplyr::group_by(SES) %>% mutate(SES_TOT = n()) %>% ungroup() %>%
dplyr::group_by(SES,FAMILY_CARE_CAT) %>% mutate(CARE_TOT = n()) %>% ungroup() %>%
mutate(CARE_PROP = CARE_TOT/SES_TOT) %>% ungroup() %>%
group_by(SES,FAMILY_CARE_CAT,CARE_PROP) %>% dplyr::summarize()
ses_care_type %>%
ggplot(aes(x = SES, y= CARE_PROP)) +
geom_bar(stat="identity",aes(color = FAMILY_CARE_CAT,fill = FAMILY_CARE_CAT)) +
theme_ipsum(base_size = 12, axis_title_size = 14) +
scale_color_futurama(alpha = 0.75) +
scale_fill_futurama(alpha = 0.75) +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
labs(title = '', color = 'Response') +
labs(linetype = "Socioeconomic Status", color = "Child Care Category", fill = "Child Care Category",
y="Proportion", x = "Socioeconomic Status (household income)", title = "Social Class and Childcare Options")
load("~/QMSS/Intergenerational_Childcare_Maternal_Wage_Gap/data/NLSY_imputed.RData")
# No filtering for only individuals with valid data around inter-generational childcare
NLSY_Valid <- NLSY_imputed %>%
filter(CV_HGC_EVER_EDT != 95 & !is.na(CV_HGC_EVER_EDT)) %>%
filter(BA_ABOVE== 1)
NSLY_Valid_Summarized <- NLSY_Valid %>% dplyr::mutate(ANY_CHILDREN = ifelse(N_CHILDREN == 0,0,1)) %>% group_by(YEAR,ANY_CHILDREN) %>% dplyr::summarize(mean_income = mean(INCOME,na.rm=TRUE)) %>% mutate(ANY_CHILDREN = ifelse(ANY_CHILDREN==0,'No Children', 'One or More Children'))
NSLY_Valid_Summarized
NSLY_Valid_Summarized$YEAR <- as.numeric(NSLY_Valid_Summarized$YEAR)
NSLY_Valid_Summarized %>%
ggplot(.,aes(x=YEAR, y=mean_income/1000)) +
geom_point(color = "#273237") +
geom_line(color = "#273237",aes(linetype = ANY_CHILDREN)) +
theme_ipsum(base_size = 12, axis_title_size = 14) +
theme(
axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)
) +
labs(title = "",
y="Mean Annual Income\n (USD, thousands)", x = "",linetype = "")
write.csv(NLSY_Valid_Childcare_Part_Time_One_Child,"~/QMSS/Intergenerational_Childcare_Maternal_Wage_Gap/data/NLSY_Valid_Childcare_Part_Time_One_Child.csv")
# Childcare Variables here are averaged across children (YCCAL), looking at respondents while their first child is under 6 years old
load("~/QMSS/Intergenerational_Childcare_Maternal_Wage_Gap/data/NLSY_imputed_first_child.RData")
NLSY_Valid_Childcare_Part_Time_1 <- Valid_Childcare_Income(NLSY_imputed,TRUE)
NLSY_Valid_Childcare_Part_Time_1 <- NLSY_Valid_Childcare_Part_Time_1[!is.na(NLSY_Valid_Childcare_Part_Time_1$FAMILY_CARE), ]
# Childcare Variables here are averaged across children (YCCAL), looking at respondents while their first child is under 6 years old
load("~/QMSS/Intergenerational_Childcare_Maternal_Wage_Gap/data/NLSY_imputed_first_child.RData")
NLSY_Valid_Childcare_Part_Time_1 <- Valid_Childcare_Income(NLSY_imputed,TRUE)
# Select relevant columns and filter for individuals with valid data about their education, filter for women with some income generating work; filter for High School +
# Make df that includes working women with valid data about childcare
Valid_Data <- function(df) {
NLSY_Valid <- df %>%
filter(CV_HGC_EVER_EDT != 95 & !is.na(CV_HGC_EVER_EDT)) %>%
filter(CV_HGC_EVER_EDT >= 12) %>% filter(YEAR>=2005)
}
Valid_Childcare <- function(df,first_child) {
NLSY_Valid <- Valid_Data(df)
NLSY_Valid_Childcare <- NLSY_Valid %>% subset(INCOME>0) %>% subset(WORK_EDU_HRS>=0) %>%
subset(WORK_EDU_HRS != 999) %>%
subset(SELF_CARE==0) %>% subset(YEAR <= BIOCHILD_6_YR)
if(first_child == TRUE) {
NLSY_Valid_Childcare <- NLSY_Valid_Childcare %>% subset(YEAR <= BIOCHILD_6_YR)
}
else{
NLSY_Valid_Childcare <- NLSY_Valid_Childcare %>% subset(CV_HH_UNDER_6>0)
}
}
# Filter for data that includes working women (Part Time and up) with valid data about childcare
Valid_Childcare_Income <- function(df,first_child) {
NLSY_Valid_Childcare <- Valid_Childcare(df,first_child)
NLSY_Valid_Childcare_Income <- NLSY_Valid_Childcare %>% subset(INCOME>0) %>% subset(PART_TIME==1)
}
# Childcare Variables here are averaged across children (YCCAL), looking at ANY child of respondent under 6
load("~/QMSS/Intergenerational_Childcare_Maternal_Wage_Gap/data/NLSY_imputed.RData")
NLSY_Valid_Childcare_Part_Time_2 <- Valid_Childcare_Income(NLSY_imputed,FALSE) # Part Time and Above
NLSY_Valid_Childcare_Income_2 <- Valid_Childcare(NLSY_imputed,FALSE) %>% subset(INCOME > 0) # Any Income Generated
NLSY_Valid_Childcare_Part_Time_2 <- NLSY_Valid_Childcare_Part_Time_2[!is.na(NLSY_Valid_Childcare_Part_Time_2$FAMILY_CARE), ]
# Childcare Variables here are averaged across children (YCCAL), looking at respondents while their first child is under 6 years old
load("~/QMSS/Intergenerational_Childcare_Maternal_Wage_Gap/data/NLSY_imputed_first_child.RData")
NLSY_Valid_Childcare_Part_Time_1 <- Valid_Childcare_Income(NLSY_imputed,TRUE)
NLSY_Valid_Childcare_Part_Time_1 <- NLSY_Valid_Childcare_Part_Time_1[!is.na(NLSY_Valid_Childcare_Part_Time_1$FAMILY_CARE), ]
NLSY_Valid_Childcare_Income_1 <- Valid_Childcare(NLSY_imputed,TRUE) %>% subset(INCOME > 0)
# Only looking at parent having one child (first child) - while their first child is under 6 years old
NLSY_Valid_Childcare_Part_Time_One_Child <- NLSY_Valid_Childcare_Part_Time_1 %>% subset(N_CHILDREN==1)
#write.csv(NLSY_Valid_Childcare_Part_Time_One_Child,"~/QMSS/Intergenerational_Childcare_Maternal_Wage_Gap/data/NLSY_Valid_Childcare_Part_Time_One_Child.csv")
NLSY_Valid_Childcare_Income_One_Child <- NLSY_Valid_Childcare_Income_1 %>% subset(N_CHILDREN==1)
psych::describe(NLSY_Valid_Childcare_Part_Time_One_Child %>% select(INCOME, MARRIED_OR_COHABITATING, BA_ABOVE,SPOUSAL_INCOME, MOTHER_AGE_FIRST_CHILD, MATERNAL_AGE,`YCCAL-6800`,FAMILY_CARE, N_CHILDREN,FULL_TIME,Relative_within_15_minutes,YEAR))
write.csv(NLSY_Valid_Childcare_Part_Time_One_Child,"~/QMSS/Intergenerational_Childcare_Maternal_Wage_Gap/data/NLSY_Valid_Childcare_Part_Time_One_Child.csv")
load("~/QMSS/Intergenerational_Childcare_Maternal_Wage_Gap/data/NLSY_imputed.RData")
# No filtering for only individuals with valid data around inter-generational childcare
NLSY_Valid <- NLSY_imputed %>%
filter(CV_HGC_EVER_EDT != 95 & !is.na(CV_HGC_EVER_EDT)) %>%
filter(BA_ABOVE== 1)
NSLY_Valid_Summarized <- NLSY_Valid %>% dplyr::mutate(ANY_CHILDREN = ifelse(N_CHILDREN == 0,0,1)) %>% group_by(YEAR,ANY_CHILDREN) %>% dplyr::summarize(mean_income = mean(INCOME,na.rm=TRUE)) %>% mutate(ANY_CHILDREN = ifelse(ANY_CHILDREN==0,'No Children', 'One or More Children'))
NSLY_Valid_Summarized
NSLY_Valid_Summarized$YEAR <- as.numeric(NSLY_Valid_Summarized$YEAR)
NSLY_Valid_Summarized %>%
ggplot(.,aes(x=YEAR, y=mean_income/1000)) +
geom_point(color = "#273237") +
geom_line(color = "#273237",aes(linetype = ANY_CHILDREN)) +
theme_ipsum(base_size = 12, axis_title_size = 14) +
theme(
axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)
) +
labs(title = "",
y="Mean Annual Income\n (USD, thousands)", x = "",linetype = "")
NLSY_imputed_FAMILY_CARE_CAT <- NLSY_imputed_FAMILY_CARE_CAT %>% subset(!is.na(`YCCAL-6800`)) %>% subset(`YCCAL-6800`!='NA')
# Load Data - YCCA / YCCAL - any child under 6 years old
load("~/QMSS/Intergenerational_Childcare_Maternal_Wage_Gap/data/NLSY_imputed.RData")
NLSY_Valid_Childcare_Part_Time_2 <- Valid_Childcare_Income(NLSY_imputed,FALSE) # Part Time and Above
library(plm)
library(dplyr)
library(plyr)
library(QMSS)
library(tidyverse)
library(stargazer)
library(psych)
library(ggplot2)
library(ggthemes)
library(ggsci)
library(viridis)
library(hrbrthemes)
library(imputeTS)
library(kableExtra)
library(naniar)
library(plotly)
library(DT)
library(tidyr)
# Select relevant columns and filter for individuals with valid data about their education, filter for women with some income generating work; filter for High School +
# Make df that includes working women with valid data about childcare
Valid_Data <- function(df) {
NLSY_Valid <- df %>%
filter(CV_HGC_EVER_EDT != 95 & !is.na(CV_HGC_EVER_EDT)) %>%
filter(CV_HGC_EVER_EDT >= 12) %>% filter(YEAR>=2005)
}
Valid_Childcare <- function(df,first_child) {
NLSY_Valid <- Valid_Data(df)
NLSY_Valid_Childcare <- NLSY_Valid %>% subset(INCOME>0) %>% subset(WORK_EDU_HRS>=0) %>%
subset(WORK_EDU_HRS != 999) %>%
subset(SELF_CARE==0) %>% subset(YEAR <= BIOCHILD_6_YR)
if(first_child == TRUE) {
NLSY_Valid_Childcare <- NLSY_Valid_Childcare %>% subset(YEAR <= BIOCHILD_6_YR)
}
else{
NLSY_Valid_Childcare <- NLSY_Valid_Childcare %>% subset(CV_HH_UNDER_6>0)
}
}
# Filter for data that includes working women (Part Time and up) with valid data about childcare
Valid_Childcare_Income <- function(df,first_child) {
NLSY_Valid_Childcare <- Valid_Childcare(df,first_child)
NLSY_Valid_Childcare_Income <- NLSY_Valid_Childcare %>% subset(INCOME>0) %>% subset(PART_TIME==1)
}
# Load Data - YCCA / YCCAL - any child under 6 years old
load("~/QMSS/Intergenerational_Childcare_Maternal_Wage_Gap/data/NLSY_imputed.RData")
NLSY_Valid_Childcare_Part_Time_2 <- Valid_Childcare_Income(NLSY_imputed,FALSE) # Part Time and Above
NLSY_Valid_Childcare_Income_2 <- Valid_Childcare(NLSY_imputed,FALSE) %>% subset(INCOME > 0) # Any Income Generated
NLSY_Valid_Childcare_Part_Time_2 <- NLSY_Valid_Childcare_Part_Time_2[!is.na(NLSY_Valid_Childcare_Part_Time_2$FAMILY_CARE), ]
# Childcare Variables here are averaged across children (YCCAL), looking at respondents while their first child is under 6 years old
load("~/QMSS/Intergenerational_Childcare_Maternal_Wage_Gap/data/NLSY_imputed_first_child.RData")
NLSY_Valid_Childcare_Part_Time_1 <- Valid_Childcare_Income(NLSY_imputed,TRUE)
NLSY_Valid_Childcare_Part_Time_1 <- NLSY_Valid_Childcare_Part_Time_1[!is.na(NLSY_Valid_Childcare_Part_Time_1$FAMILY_CARE), ]
NLSY_Valid_Childcare_Income_1 <- Valid_Childcare(NLSY_imputed,TRUE) %>% subset(INCOME > 0)
# Only looking at parent having one child (first child) - while their first child is under 6 years old
NLSY_Valid_Childcare_Part_Time_One_Child <- NLSY_Valid_Childcare_Part_Time_1 %>% subset(N_CHILDREN==1)
NLSY_Valid_Childcare_Income_One_Child <- NLSY_Valid_Childcare_Income_1 %>% subset(N_CHILDREN==1)
psych::describe(NLSY_Valid_Childcare_Part_Time_One_Child %>% select(INCOME, MARRIED_OR_COHABITATING, BA_ABOVE,SPOUSAL_INCOME, MOTHER_AGE_FIRST_CHILD, MATERNAL_AGE,`YCCAL-6800`,FAMILY_CARE, N_CHILDREN,FULL_TIME,Relative_within_15_minutes))
psych::describe(NLSY_Valid_Childcare_Part_Time_One_Child %>% select(INCOME, MARRIED_OR_COHABITATING, BA_ABOVE,SPOUSAL_INCOME, MOTHER_AGE_FIRST_CHILD, MATERNAL_AGE,`YCCAL-6800`,FAMILY_CARE, FORMAL_CHILDCARE, N_CHILDREN,FULL_TIME,Relative_within_15_minutes) %>% subset(FORMAL_CHILDCARE ==1))
psych::describe(NLSY_Valid_Childcare_Part_Time_One_Child %>% subset(FORMAL_CHILDCARE ==1) %>% select(INCOME, MARRIED_OR_COHABITATING, BA_ABOVE,SPOUSAL_INCOME, MOTHER_AGE_FIRST_CHILD, MATERNAL_AGE,`YCCAL-6800`,WORK_EDU_HRS, N_CHILDREN,Relative_within_15_minutes) %>% )
psych::describe(NLSY_Valid_Childcare_Part_Time_One_Child %>% subset(FORMAL_CHILDCARE ==1) %>% select(INCOME, MARRIED_OR_COHABITATING, BA_ABOVE,SPOUSAL_INCOME, MOTHER_AGE_FIRST_CHILD, MATERNAL_AGE,`YCCAL-6800`,WORK_EDU_HRS, N_CHILDREN,Relative_within_15_minutes))
psych::describe(NLSY_Valid_Childcare_Part_Time_One_Child %>% subset(FAMILY_CARE ==1) %>% select(INCOME, MARRIED_OR_COHABITATING, BA_ABOVE,SPOUSAL_INCOME, MOTHER_AGE_FIRST_CHILD, MATERNAL_AGE,`YCCAL-6800`,WORK_EDU_HRS, N_CHILDREN,Relative_within_15_minutes))
psych::describe(NLSY_Valid_Childcare_Part_Time_One_Child %>% subset(WORK_EDU_HRS ==0) %>% select(INCOME, MARRIED_OR_COHABITATING, BA_ABOVE,SPOUSAL_INCOME, MOTHER_AGE_FIRST_CHILD, MATERNAL_AGE,`YCCAL-6800`,WORK_EDU_HRS, N_CHILDREN,Relative_within_15_minutes))
psych::describe(NLSY_Valid_Childcare_Part_Time_One_Child %>% select(INCOME, MARRIED_OR_COHABITATING, BA_ABOVE,SPOUSAL_INCOME, MOTHER_AGE_FIRST_CHILD, MATERNAL_AGE,`YCCAL-6800`,WORK_EDU_HRS, N_CHILDREN,Relative_within_15_minutes))
psych::describe(NLSY_Valid_Childcare_Part_Time_One_Child %>% select(INCOME, MARRIED_OR_COHABITATING, CV_HGC_EVER_EDT,SPOUSAL_INCOME, MOTHER_AGE_FIRST_CHILD, MATERNAL_AGE,`YCCAL-6800`,WORK_EDU_HRS, N_CHILDREN,Relative_within_15_minutes))
psych::describe(NLSY_Valid_Childcare_Part_Time_One_Child %>% subset(FAMILY_DAY_CARE ==1) %>% select(INCOME, MARRIED_OR_COHABITATING, CV_HGC_EVER_EDT,SPOUSAL_INCOME, MOTHER_AGE_FIRST_CHILD, MATERNAL_AGE,`YCCAL-6800`,WORK_EDU_HRS, N_CHILDREN,Relative_within_15_minutes))
psych::describe(NLSY_Valid_Childcare_Part_Time_One_Child %>% subset(FAMILY_CARE ==1) %>% select(INCOME, MARRIED_OR_COHABITATING, CV_HGC_EVER_EDT,SPOUSAL_INCOME, MOTHER_AGE_FIRST_CHILD, MATERNAL_AGE,`YCCAL-6800`,WORK_EDU_HRS, N_CHILDREN,Relative_within_15_minutes))
NSLY_Valid_Summarized <- NLSY_Valid %>% dplyr::mutate(ANY_CHILDREN = ifelse(N_CHILDREN == 0,0,1)) %>% group_by(YEAR,ANY_CHILDREN) %>% dplyr::summarize(mean_income = mean(INCOME,na.rm=TRUE)) %>% mutate(ANY_CHILDREN = ifelse(ANY_CHILDREN==0,'No Children', 'One or More Children'))
NSLY_Valid_Summarized
NSLY_Valid_Summarized$YEAR <- as.numeric(NSLY_Valid_Summarized$YEAR)
NSLY_Valid_Summarized %>%
ggplot(.,aes(x=YEAR, y=mean_income/1000)) +
geom_point(color = "#273237") +
geom_line(color = "#273237",aes(linetype = ANY_CHILDREN)) +
theme_ipsum(base_size = 12, axis_title_size = 14) +
theme(
axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)
) +
labs(title = "",
y="Mean Annual Income\n (USD, thousands)", x = "",linetype = "")
NSLY_Valid_Summarized %>%
ggplot(.,aes(x=YEAR, y=mean_income/1000)) +
geom_point(aes(color = ANY_CHILDREN)) +
geom_line(aes(color = ANY_CHILDREN)) +
scale_color_manual(values = c("#ffb000","#002728")) +
theme_ipsum(base_size = 12, axis_title_size = 14) +
theme(
axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)
) +
labs(title = "",
y="Mean Annual Income\n (USD, thousands)", x = "",linetype = "")
# No filtering for only individuals with valid data around inter-generational childcare
NLSY_Valid <- NLSY_imputed %>%
filter(CV_HGC_EVER_EDT != 95 & !is.na(CV_HGC_EVER_EDT)) %>% group_by(PUBID_1997) %>% mutate(max_education = max(CV_HGC_EVER_EDT)) %>% ungroup() %>% subset(max_education == CV_HGC_EVER_EDT)
NSLY_Valid_Summarized <- NLSY_Valid %>% dplyr::mutate(ANY_CHILDREN = ifelse(N_CHILDREN == 0,0,1)) %>% group_by(YEAR,ANY_CHILDREN) %>% dplyr::summarize(mean_income = mean(INCOME,na.rm=TRUE)) %>% mutate(ANY_CHILDREN = ifelse(ANY_CHILDREN==0,'No Children', 'One or More Children'))
NSLY_Valid_Summarized
NSLY_Valid_Summarized$YEAR <- as.numeric(NSLY_Valid_Summarized$YEAR)
NSLY_Valid_Summarized %>%
ggplot(.,aes(x=YEAR, y=mean_income/1000)) +
geom_point(aes(color = ANY_CHILDREN)) +
geom_line(aes(color = ANY_CHILDREN)) +
scale_color_manual(values = c("#ffb000","#002728")) +
theme_ipsum(base_size = 12, axis_title_size = 14) +
theme(
axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)
) +
labs(title = "",
y="Mean Annual Income\n (USD, thousands)", x = "",linetype = "")