# How to plot mortality at age curve using lifespan data

I have a table with the lifespan of multiple individuals from a species and would like to use this data to plot a mortality rate curve, similar to that shown in figure 1 of this study:https://www.nature.com/articles/srep36361.pdf

My data looks like this:

age in days at death
5
8
202
302
24
300
295
277
8114
195
169
257
1
7490
2938
334
7793
566
194
6698
164
1
5371
5282
0
1327
3
2301
367
177
1
286
496
8309
3074
964
10843
252
265
4256
0
0
88
3
3614
5708
8519
325
8367


Each entry is the age of an individual (in days) when it died. Could anyone point me towards a package or equation for plotting a mortality rate curve? I believe it can be quite simply done by fitting a generalised additive model (GAM)in ggplot2:

 geom_smooth(method = "gam", formula = y ~s(x))


However I believe the data might first have to be transformed to show number of animals alive at different age ranges. If anyone has experience with plotting mortality/senescence curves and could advise on how this data may need to be transformed that would be most helpful.

## 1 Answer

If you understand mortality rate to be the rate at which individuals die between regular time intervals, then you'd want to identify the time interval and how many individuals of the total population decease during each interval. I do this and comment below.

dat <- c(5, 8, 202, 302, 24, 300, 295, 277, 8114, 195, 169, 257, 1, 7490, 2938,
334, 7793, 566, 194, 6698, 164, 1, 5371, 5282, 0, 1327, 3, 2301, 367, 177, 1,
286, 496, 8309, 3074, 964, 10843, 252, 265, 4256, 0, 0, 88, 3, 3614, 5708, 8519,
325, 8367)

n.dat <- length(dat)

interval <- 365 # Time interval (I set 365 incase the units of your data were in
# days)
max.dat <- max(dat)
bins <- seq(from = 0, to = max.dat, by = interval)
counts <- table(cut(x = dat, breaks = bins))/n.dat

plot(x = bins[-1]/365, y = as.numeric(counts), type = "l", las = 1) # there's
# always 1 bin point greater than the count, so one needs to be removed or
# midpoints can be calculated


These data suggest that the mortality rate is primarily when the organism is very young (within the first year), but relatively steady until just after 20 years.

There's really no reason to smooth make an arbitrary "curve" unless you are aiming to create a predictive model from these data, but it doesn't seem like that is your intent.