# Slide 7: Constant hazard figure x <- seq(0,1,.1) y <- rep(1, length(x)) plot(x, y, type='l', lwd=3, xlab='t', ylab=expression(lambda(t)), xaxt='n', yaxt='n', bty='n', ylim=c(0,2.1)) axis(1, at=c(0,1), labels=c(0, '')) axis(2, at=c(0,1,2), labels=c(0, expression(lambda), ''), las=1) # Read in and prepare human mortality data; # this is a homework question, so I'm not providing my code here # Slide 15: Human mortality, distribution with(Data, plot(Age, Total/1000, las=1, lwd=3, col='slateblue', type='o', pch=19, ylab='Deaths (thousands)', bty='n')) # Slide 16: Human mortality, hazard AtRisk <- rev(cumsum(c(Remainder$Total, rev(Data$Total)))[-1]) Hazard <- Data$Total/AtRisk plot(Age, Hazard, las=1, lwd=3, col='slateblue', type='o', pch=19, bty='n') # Slide 17: Human mortality, hazard, zoomed plot(Age, Hazard, ylim=c(0, 0.01), xlim=c(0, 60), las=1, lwd=3, col='slateblue', type='o', pch=19, bty='n')