Hello all,
I would like some help with the following. I have historic data on the counts of a particular procedure each year (1999-2020), for each age band (10-20, etc) and gender (binary). For these years I also have the corresponding population sizes for each age band and gender. I want to develop a poisson model on this data and use it to estimate the counts for years 2021-2050. For years 2021-2050 I have population forecast data (population sizes) for each patient age group and gender as recorded above, and of course, missing counts. I would like to generate a graph that shows the predicted counts (and incidence rates) overall, and for each age group or gender subgroup. The code I am using is below:
The above code gives me the graph I want, though I am not sure how to aggregate the confidence intervals previously generated for each subgroup?
For incidence rates I would just generate them as in the code below, but again, I am not sure how I would obtain the confidence intervals for this?
To then generate similar graphs for each age_band and/or gender, would I need to aggregate them as I have done above (using bysort) or is there a better way?
Many thanks in advance for your help,
Markos
I would like some help with the following. I have historic data on the counts of a particular procedure each year (1999-2020), for each age band (10-20, etc) and gender (binary). For these years I also have the corresponding population sizes for each age band and gender. I want to develop a poisson model on this data and use it to estimate the counts for years 2021-2050. For years 2021-2050 I have population forecast data (population sizes) for each patient age group and gender as recorded above, and of course, missing counts. I would like to generate a graph that shows the predicted counts (and incidence rates) overall, and for each age group or gender subgroup. The code I am using is below:
Code:
poisson count year i.age_band i.gender if year<2021, exposure (pop_size) predictnl prediction_count=predict(n), ci(lb ub) bysort year: egen count_sum = sum(count) //total the counts, predicted counts and pop_size for each year bysort year : egen prediction_sum = sum(prediction) bysort year : egen pop_size_sum =sum(pop_size) bysort year_primary : keep if _n==1 twoway (line prediction_sum year) (line count_sum year)
For incidence rates I would just generate them as in the code below, but again, I am not sure how I would obtain the confidence intervals for this?
Code:
gen rate_predicted_sum = prediction_sum / pop_size_sum *100000 twoway (line rate_predicted_sum year)
Many thanks in advance for your help,
Markos