0
$\begingroup$

Can you directly estimate the age at which a maximum rate occurs in a population?

I have a dataset including counts of events and person-years, stratified by year and age. There is a strong cohort effect, and it appears that the age at which the maximum rate occurs increases by one per year. So in 1990 the highest rate is at roughly age 15, and in 2020 the highest rate is at roughly age 45.

I want to estimate the annual increase in the age at which the maximum rate occurs (and also the intercept).

Here is some example data created using R (using the data.table package because I couldn't work out how to melt data in base R) - no need to look into this too much; the important bit comes afterwards.

# create sample data
library(data.table)
ages <- 15:65
years <- 1990:2020
d <- CJ(age = ages, year = years)
d[, person_years := sample(300000:500000, .N, replace = T)]
max_rate <- min(ages) + years - min(years)
find_rate <- function(x) pmin(pnorm(ages, x, 15), pnorm(ages, x, 15, lower.tail = F)) * 10
rates <- sapply(max_rate, find_rate)
rates <- as.data.table(rates)
colnames(rates) <- as.character(years)
rates[, age := ages]
rates <- melt(rates, id.vars = 'age', variable.name = 'year', value.name = 'rate')
rates[, year := as.integer(as.character(year))]
d <- rates[d, on = c('age', 'year')]
d[, events := rpois(.N, rate)]
d[, rate := NULL]

I tried calculating stratified rates, finding the age at which the maximum rate occurs within each year, then fitting a line of best fit through these ages using linear regression.

d[, actual_rate := events / pys * 100000]
d[, max_rate := actual_rate == max(actual_rate), year]

plot(d[max_rate == T]$year, d[max_rate == T]$age, xlim = range(years), ylim = range(ages))
m <- lm(age ~ year, d[max_rate == T])
abline(m)

This left me feeling uneasy because the model only uses a small subset of the data. Is there a way to fit a poisson model on the full data that estimates the association between year and the age at which the maximum rate occurs?

$\endgroup$
  • $\begingroup$ Could you explain what a "population rate" is and show exactly how it is determined by counts of "events" and "person-years"? $\endgroup$ – whuber Feb 10 at 19:46
  • $\begingroup$ Yes - by 'population rate', I think I just mean 'rate'. It's the events divided by the person-years. In the example I've also multiplied this value by 100000, but this is just presentational. I think 'rate' might be easier to understand than 'population rate' so I'll edit my question accordingly. $\endgroup$ – Dan Feb 10 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.