Skip to content
Matthieu Stigler edited this page Apr 15, 2014 · 1 revision

FIGURE MHE 4.1.1 A

library(RcompAngrist)
library(plyr)
library(ggplot2)

Reshape data:

data(AngKrug91)
AK91_Q <- ddply(AngKrug91, .(yqob), summarize, lwklywge_Q = mean(lwklywge), 
    educ_Q = mean(educ), Quarter = factor(unique(qob)))

Plot

plot_Wage <- qplot(x = yqob, y = lwklywge_Q, data = AK91_Q, geom = "line") + 
    geom_point(aes(colour = Quarter), size = 3) + theme(legend.position = "bottom") + 
    scale_x_continuous(breaks = 30:39) + xlab("Year of birth") + ylab("Log weekly earnings")

plot_Wage
plot of chunk unnamed-chunk-3

And second plot:

plot_Educ <- qplot(x = yqob, y = educ_Q, data = AK91_Q, geom = "line") + geom_point(aes(colour = Quarter), 
    size = 3) + theme(legend.position = "bottom") + scale_x_continuous(breaks = 30:39) + 
    xlab("Year of birth") + ylab("Years of education")

plot_Educ
plot of chunk unnamed-chunk-4
Clone this wiki locally