Skip to content

Make age probability inclusive in cpt_pop_function() #14

@hkhk33333

Description

@hkhk33333

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions