occup | R Documentation |
This is the data that is behind the illustrative Lexis diagram in Breslow & Day's book on case-control studies.
data(occup)
A data frame with 13 observations on the following 4 variables.
AoE
a numeric vector, Age at Entry
DoE
a numeric vector, Date of entry
DoX
a numeric vector, Date of eXit
Xst
eXit status D
-event, W
-withdrawal,
X
-censoring
Breslow & Day: Statistical Methods in Cancer Research, vol 1: The analysis of case-control studies, figure 2.2, p. 48.
data(occup)
lx <- Lexis( entry = list( per=DoE, age=AoE ),
exit = list( per=DoX ),
entry.status = "W",
exit.status = Xst,
data = occup )
plot( lx )
# Split follow-up in 5-year classes
sx <- splitLexis( lx, seq(1940,1960,5), "per" )
sx <- splitLexis( sx, seq( 40, 60,5), "age" )
plot( sx )
# Plot with a bit more paraphernalia and a device to get
# the years on the same physical scale on both axes
ypi <- 2.5 # Years per inch
dev.new( height=15/ypi+1, width=20/ypi+1 ) # add an inch in each direction for
par( mai=c(3,3,1,1)/4, mgp=c(3,1,0)/1.6 ) # the margins set in inches by mai=
plot(sx,las=1,col="black",lty.grid=1,lwd=2,type="l",
xlim=c(1940,1960),ylim=c(40,55),xaxs="i",yaxs="i",yaxt="n",
xlab="Calendar year", ylab="Age (years)")
axis( side=2, at=seq(40,55,5), las=1 )
points(sx,pch=c(NA,16)[(sx$lex.Xst=="D")+1] )
box()
# Annotation with the person-years
PY.ann.Lexis( sx, cex=0.8 )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.