死亡人数
Cynthia 的教授现在让她研究生命表中的死亡人数。年龄为 \(x\) 的死亡数记为 $d_x$。您能按年龄 \(x\) 展示死亡人数 \(d_x\) 吗?
此外,Cynthia 了解到,\(d_x\) 是在一组有 \(\ell_x\) 名生存者中,于年龄 \(x\) 去世的人数的期望值。您将为年龄 \(x\) 的死亡人数生成二项分布样本,并将模拟数据与记录的 \(d_x\) 进行比较。
对象 life_table 已预加载到您的 R 工作区,同时还提供提取出的列 age、qx、lx 和 dx。
本练习是课程的一部分
用 R 评估人寿保险产品
练习说明
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Plot the number of deaths dx by age
plot(___, ___,
type = "h",
pch = 20,
xlab = "Age x",
ylab = expression("d"[x]),
main = "Number of deaths (Belgium, females, 1999)")
# Simulate the number of deaths using a binomial distribution
sims <- ___(n = ___, size = ___, prob = ___)
# Plot the simulated number of deaths on top of the previous graph
points(___, ___,
pch = 4,
col = "red")