[1] "Created: Wed Apr  1 16:39:44 2015"

See the introduction for an overview.

library(lme4)
library(ggplot2)
options(digits=5,show.signif.stars=FALSE)

Load in and summarize the data:

data(psid, package="faraway")
head(psid)
  age educ sex income year person
1  31   12   M   6000   68      1
2  31   12   M   5300   69      1
3  31   12   M   5200   70      1
4  31   12   M   6900   71      1
5  31   12   M   7500   72      1
6  31   12   M   8000   73      1
summary(psid)
      age            educ      sex         income            year     
 Min.   :25.0   Min.   : 3.0   F:732   Min.   :     3   Min.   :68.0  
 1st Qu.:28.0   1st Qu.:10.0   M:929   1st Qu.:  4300   1st Qu.:73.0  
 Median :34.0   Median :12.0           Median :  9000   Median :78.0  
 Mean   :32.2   Mean   :11.8           Mean   : 13575   Mean   :78.6  
 3rd Qu.:36.0   3rd Qu.:13.0           3rd Qu.: 18050   3rd Qu.:84.0  
 Max.   :39.0   Max.   :16.0           Max.   :180000   Max.   :90.0  
     person    
 Min.   : 1.0  
 1st Qu.:20.0  
 Median :42.0  
 Mean   :42.4  
 3rd Qu.:63.0  
 Max.   :85.0  

Construct some plots:

library(dplyr)
psid20 <- filter(psid, person <= 20)
ggplot(psid20, aes(x=year, y=income))+geom_line()+facet_wrap(~ person)

plot of chunk unnamed-chunk-4

ggplot(psid20, aes(x=year, y=income+100, group=person)) +geom_line()+facet_wrap(~ sex)+scale_y_log10()