Min. 1st Qu. Median Mean 3rd Qu. Max.
2001 2001 2001 2001 2002 2002
#year of birthsummary(w3$h3od1y)
Min. 1st Qu. Median Mean 3rd Qu. Max.
1974 1978 1979 1979 1981 1983
# Current age: year of survey minus age at birthw3$age <- (w3$iyear3 -w3$h3od1y)summary(w3$age)
Min. 1st Qu. Median Mean 3rd Qu. Max.
18.0 21.0 22.0 22.2 24.0 28.0
# Year of survey for wave 4summary(w4$iyear4)
Min. 1st Qu. Median Mean 3rd Qu. Max.
2007 2008 2008 2008 2008 2009
#year of birthsummary(w4$h4od1y)
Min. 1st Qu. Median Mean 3rd Qu. Max.
1974 1978 1979 1979 1980 1983
# Current age is year of survey minus age at birthw4$age <- (w4$iyear4 -w4$h4od1y)summary(w4$age)
Min. 1st Qu. Median Mean 3rd Qu. Max.
25 28 29 29 30 34
#Current age: year of survey minus age at birth#w5$age <- (w5$iyear5 -w5$h5od1y)#summary(w5$age)
## Childhood maltreatments#w3$neglect1<- car::Recode(w3$h3ma1,recodes="1:5='1'; 6='0'; else=NA")#w3$neglect2<- car::Recode(w3$h3ma2,recodes="1:5='1'; 6='0'; else=NA")w3$physical<- car::Recode(w3$h3ma3,recodes="1:5='Physical abuse'; 6='No physical abuse'; else=NA", as.factor = T)w3$sexual<- car::Recode(w3$h3ma4,recodes="1:5='sexually abused'; 6='No sexual abuse'; else=NA", as.factor = T)#w3$neg<- paste(w3$neglect1, w3$neglect2, sep = "")#table(w3$neg)#w3$neglect<- car::Recode(w3$neg,recodes="11|12|13|21|31=1; 22|23|32=0; else=NA")#table(w3$neglect)#w4$neglect<- car::Recode(w4$h4ma1,recodes="1:5=1; 6=0; else=NA")#w4$physical<- car::Recode(w4$h4ma3,recodes="1:5=1; 6=0; else=NA")#w4$sexual<- car::Recode(w4$h4ma5,recodes="1:5=1; 6=0; else=NA")#Employment status#h3da28: Do you currently have a job?w3$empstat<- car::Recode(w3$h3da28,recodes="1='Yes'; 0='No'; else=NA", as.factor = T)#H4LM11: Do you currently work 10 hours per week?#w4$empstat<- car::Recode(w4$h4lm11,recodes="1=1; 0=0; else=NA")#Race/Ethnicityw3$hisp <- car::Recode(w3$h3od2, recodes ="1= 'Hisp' ; 0= 'NH'; else=NA")w3$race <- car::Recode(w3$h3ir4, recodes ="1= 'White'; 2= 'Black'; 3:4='Other'; else=NA")w3$race_eth<-ifelse(w3$hisp ==1, "Hisp", w3$race)w3$race_eth <-interaction(w3$hisp, w3$race) w3$race_ethr<-mutate(w3, ifelse(hisp==0& race==1, 1,ifelse(hisp==0& race==2, 2,ifelse(hisp==1, 3,ifelse(hisp==0& race==3, 4,ifelse(hisp==0& race==4, 5, "NA"))))))w3$race_ethr<-ifelse(substr(w3$race_eth, 1, 4)=="Hisp", "Hisp", as.character(w3$race_eth))#Education#What is the highest grade or year of regular school you have completed?w3$educ <- car::Recode(w3$h3ed1, recodes ="6:12= 'Upto HS' ; 13:22= 'Higher than HS'; else=NA", as.factor = T)#w4$educ <- car:: Recode(w4$h4ed2, recodes = "1:3 = 'upto to HS'; 4:13 = 'higher than HS'; else = NA")
# Depression## h3id15: Have you ever been diagnosed with depression##h4id5h: Has a doctor, nurse or other health care provider ever told you that you have or had: depression?w3$dep <- car::Recode(w3$h3id15,recodes="1=1; 0=0; else=NA", as.factor= T)w4$dep <- car::Recode(w4$h4id5h,recodes="1=1; 0=0; else=NA", as.factor= T)#w3 <- w3%>%# filter(h3id15 == 1)#w4<-w4%>%# filter(h4id5h==1)
# Combine all wavesallwaves <-left_join(w3, w4, by="aid")#allwaves <- left_join(allwaves, w5, by="aid")allwaves <-left_join(allwaves,wt, by ="aid")
# time varying variables- Health and ageallwaves2$age_1<- allwaves2$age.xallwaves2$age_2<- allwaves2$age.yallwaves2$dep_1<-allwaves2$dep.xallwaves2$dep_2<-allwaves2$dep.y
elong%>%mutate(ager =round((age_enter+age_enter)/2) )%>%group_by(ager)%>%summarise(prop_event=mean(deptran, na.rm=T))%>%ggplot()+aes(x=ager, y= prop_event)+scale_x_continuous(breaks =seq(18, 30, by =1))+scale_y_continuous(breaks =seq(0, 0.3, by =0.05))+ggtitle("Figure 1: Hazard of getting diagnosed with depression by time")+geom_line()
Figure 1 shows the risk of being diagnosed with depression among adults aged 19-26 who were exposed to childhood maltreatment as a child. The graph shows that between age 19 and 26 the risk of being diagnosed with depression is largely constant.
e.plot <- elong%>%mutate(ager =round((age_enter+age_enter)/2) )%>%group_by(ager, educ)%>%summarise(prop_event=mean(deptran, na.rm=T))%>%ggplot()+aes(x=ager, y= prop_event, color=factor(educ) )+scale_x_continuous(breaks =seq(18, 30, by =1))+scale_y_continuous(breaks =seq(0, 0.3, by =0.05))+#ggtitle(subtitle = "Figure 2: Hazard of depression diagnosis by age and demographic properties")+geom_line()
`summarise()` has grouped output by 'ager'. You can override using the
`.groups` argument.
s.plot <- elong%>%mutate(ager =round((age_enter+age_enter)/2) )%>%group_by(ager, sex)%>%summarise(prop_event=mean(deptran, na.rm=T))%>%ggplot()+aes(x=ager, y= prop_event, color=factor(sex) )+scale_x_continuous(breaks =seq(18, 30, by =1))+scale_y_continuous(breaks =seq(0, 0.3, by =0.05))+#ggtitle("Figure 3: Hazard of getting diagnosed with depression as function of age by sex")+geom_line()
`summarise()` has grouped output by 'ager'. You can override using the
`.groups` argument.
r.plot <-elong%>%mutate(ager =round((age_enter+age_enter)/2) )%>%group_by(ager, race_ethr)%>%summarise(prop_event=mean(deptran, na.rm=T))%>%ggplot()+aes(x=ager, y= prop_event, color=factor(race_ethr) )+scale_x_continuous(breaks =seq(18, 30, by =1))+scale_y_continuous(breaks =seq(0, 0.3, by =0.05))+#ggtitle("Figure 4: Hazard of getting diagnosed with depression as function of age by race/ethnicity")+geom_line()
`summarise()` has grouped output by 'ager'. You can override using the
`.groups` argument.
emp.plot <-elong%>%mutate(ager =round((age_enter+age_enter)/2) )%>%group_by(ager, empstat)%>%summarise(prop_event=mean(deptran, na.rm=T))%>%ggplot()+aes(x=ager, y= prop_event, color=factor(empstat) )+scale_x_continuous(breaks =seq(18, 30, by =1))+scale_y_continuous(breaks =seq(0, 0.3, by =0.05))+#ggtitle("Figure 5: Hazard of getting diagnosed with depression as function of age by employment status")+geom_line()
`summarise()` has grouped output by 'ager'. You can override using the
`.groups` argument.
Figure 2 summarizes the probability of getting diagnosed with depression as function of age among adults who have experienced either physical or sexual maltreatment as a child. Figure 2A shows that adults across the age of 19-26 who have education level upto high school are more likely to be diagnosed with depression compared to people with higher degree. Female who experience childhood abuse are also more likely to develop depression compared male (Figure 2B). Similarly Figure 2C shows that NH-Whites are more likely to be diagnosed with depression across age of 18-26 if they experienced childhood maltreatment. Finally, Figure 2D shows that through age 18-24, age and depression among were independent but at and beyond age 25 unemployed people with childhood maltreatment are more likely to be diagnosed with depression.
General linear binomial modeling suggests adults with education level upto high school and who were maltreated as child are 40% ( 28.5% using log-log model) times more likely to be diagnosed with depression as adult compared to adults with HS degree or higher. Furthermore, Figure 3 shows the hazard of developing depression among adults who were maltreated as child. The result shows that there is a gap of atleast 6 years before adults are at risk of being diagnosed with depression and the risk of getting diagnosed with depression increases slightly between year 6 and 8 before it increases sharply around year 9 and year 10 (age24-26).
St<-NA time<-1:length(haz) St[1]<-1-haz[1]for(i in2:length(haz)){ St[i]<-St[i-1]* (1-haz[i]) } St<-c(1, St) time<-c(0, time)plot(y=St,x=time, type="l",main="Figure 4: Survival function for Depression")
Survival function of depression diagnosis is plotted in Figure 4 and shows that the risk of developing depression among adults decreases to ~0.7 from 1 as the time from maltreatment incident increases. In this study Figure 4 shows that there is a steady drop in risk of depression diagnosis between year 1 and year 8 and this risk decreases sharply between year 9 and year 10.
Table 1 shows the relationship between risk of being diagnosed with depression among adults who experienced childhood maltreatment (physical and sexual). Results show that as the risk of depression diagnosis increases between year 7 and year 11. Similarly, it was found that the childhood physical abuse increases the risk of getting depression by 32.6%. Similarly, adults with high school degree or less are at higher risk (41.3 %) of developing depression compared adults with HS degree or higher. Finally in terms of race /ethnicity, it was found that NH-Whites are at 55.0% higher risk of developing depression compared to other races. Sexual maltreatment and employment status did not show statistically significant association to risk of developing depression. It should be noted that interaction parameters did not affect risk od being diagnosed with depression.
plot(genmod~year, dat, type="l", ylab="h(t)", xlab="Time", ylim=c(0, .12), xlim=c(0, 12))title(main="Figure 5: Hazard function from different time parameterizations")lines(lin~year, dat, col=2, lwd=2)lines(sq~year, dat, col=3, lwd=2)lines(cub~year, dat, col=4, lwd=2)lines(quart~year, dat, col=5, lwd=2)lines(spline~year, dat, col=6, lwd=2)legend("topleft",legend=c("General Model", "Linear","Square", "Cubic", "Quartic", "Natural spline"),col=1:6, lwd=1.5)
Figure 5 shows the hazard function for different particularization of time (linear, quadratic, cubic, quartic and spline), it can be seen in the figure that other than natural spline fit all other parametrization showed similar trend in risk of being diagnosed with depression where there is an gradual increase in risk between year 7 and 9 and a sharp jump in risk around year 10 and year 11. Spline parametrization, on the other hand, show gradual increase from year 5 to 7 and drop in risk of depression diagnosis between year 7 and year 9 after which there is a spike. AIC analysis (Table 2) shows that spline fit have lowest aid hence is considered most accurate model.
#AIC table aic<-round(c( fit.l$deviance+2*length(fit.l$coefficients), fit.s$deviance+2*length(fit.s$coefficients), fit.c$deviance+2*length(fit.c$coefficients), fit.q$deviance+2*length(fit.q$coefficients), fit.sp$deviance+2*length(fit.sp$coefficients), fit.0$deviance+2*length(fit.0$coefficients)),2)#compare all aics to the one from the general model dif.aic<-round(aic-aic[6],2) t3<-data.frame(Model =c( "Linear","Quadratic", "Cubic", "Quartic","Spline", "General"), AIC=aic, AIC_dif=dif.aic) knitr::kable(t3)
Model
AIC
AIC_dif
Linear
2567.03
12.58
Quadratic
2567.21
12.76
Cubic
2544.45
-10.00
Quartic
2542.45
-12.00
Spline
2540.45
-14.00
General
2554.45
0.00
#AIC table aic<-round(c( fit.l$deviance+2*length(fit.l$coefficients), fit.s$deviance+2*length(fit.s$coefficients), fit.c$deviance+2*length(fit.c$coefficients), fit.q$deviance+2*length(fit.q$coefficients), fit.sp$deviance+2*length(fit.sp$coefficients), fit.0$deviance+2*length(fit.0$coefficients)),2)#compare all aics to the one from the general model dif.aic<-round(aic-aic[6],2)data.frame(model =c( "linear","quadratic", "cubic", "quartic","spline", "general"),aic=aic,aic_dif=dif.aic)
model aic aic_dif
1 linear 2567.03 12.58
2 quadratic 2567.21 12.76
3 cubic 2544.45 -10.00
4 quartic 2542.45 -12.00
5 spline 2540.45 -14.00
6 general 2554.45 0.00