Exercise

# The number of deaths

Cynthia's professor now asks her to explore the number of deaths in the life table. The deaths at age \(x\) are labeled \(d_x\). Can you picture the number of deaths \(d_x\) by age \(x\)?

Moreover, Cynthia learned that \(d_x\) is the expected number of people who die at age \(x\) out of a group of \(\ell_x\) survivors. You will generate binomial samples for the number of deaths at age \(x\) and compare simulated data with the registered \(d_x\).

The object `life_table`

is preloaded in your R workspace as well as the extracted columns `age`

, `qx`

, `lx`

and `dx`

.

Instructions

**100 XP**

- Plot
`dx`

versus`age`

to examine the number of deaths by age. Using`type = "h"`

you obtain vertical lines instead of points. - Simulate the number of deaths at each age \(x\) based on the number of survivors
`lx`

and the mortality rates`qx`

. Use`rbinom()`

to generate in a vectorized way from a binomial distribution. - Plot the simulated number of deaths
`sims`

on top of the existing graph using`points()`

. Crosses are used as symbols by specifying`pch = 4`

.