This is small issue but I noticed that in function cpt_pop_function() the way age range probability (T1p) is calculated is not accurate. Code currently defines Age <- seq(1:80) and computes T1p <- (MPmax - MPmin) / length(Age). But this approach slightly underestimates the true probability because it ignores the inclusive nature of ages (for example, 34–46 covers 13 ages, not 12) but using this formula (MPmax - MPmin) will return 12. To improve accuracy I suggest changing it to:
Age <- 1:80
T1p <- mean(Age >= MPmin & Age <= MPmax)
This makes all integer ages within the range are correctly counted