\begin{Schunk}
\begin{Sinput}
 par(xpd=T)
 men <- dat[dat$sex %in% levels(dat$sex)[1], ] 
 women <- dat[dat$sex %in% levels(dat$sex)[2], ]
 womend <- density(women$sei,na.rm = TRUE) 
 mend <- density(men$sei, na.rm = TRUE)
 mh <- hist(men$sei, xlab= "Socio-economic Index", ylab = "Proportion", xlim=c(0,100), ylim = c(0, 0.04), breaks = 25, prob = TRUE, main="")
 lines(mend, lty=2)
 text(10, 0.01, label=c("kernel \n density \n estimate"),pos=3)
 arrows(10, 0.01, 18,0.003, lty=2, length=0.1)
 text( 0.8*max(men$sei,na.rm = TRUE), 0.035, label = paste("mean=", round(mean(men$sei, na.rm =T),2), "\n std.dev. =", round(sd(men$sei,na.rm=T),2)), pos=3 )
\end{Sinput}
\end{Schunk}
