Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calculating incidence rates using ONS denominators

    Hello,

    I have a dataset of admissions to hospital in UK in children aged 0-16 in one dataset and I have UK ONS population denominators for children aged 0-16 over the same time period.

    I am really struggling with calculating incidence rates with CIs and epitab hasn't been helpful so far.

    I think I am right in thinking that the only way to calculate incidence rates is to collapse my dataset as creating dummy variables based on denominator populations would mean a dataset of 12 million plus.

    I have collapsed my data (here is an extract)
    I want to generate incidence rates with 95% CIs for each year for both total and by cpi (child poverty index) quintile.

    I'd be really grateful for any advice

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input int year long denominatorpopulation int cases long cpiquintile_num
    2003  2221292  1810 1
    2003  2140889  2000 2
    2003  2125456  2023 3
    2003  2254005  2536 4
    2003  2643729  3832 5
    2003   372995  1068 6
    2003 11758366 13269 7
    2004  2210829  1758 1
    2004  2132738  1841 2
    2004  2113518  1938 3
    2004  2236230  2549 4
    2004  2633455  4011 5
    2004   384492  1910 6
    2004 11711262 14007 7
    end
    label values cpiquintile_num cpiquintile_num
    label def cpiquintile_num 1 "1", modify
    label def cpiquintile_num 2 "2", modify
    label def cpiquintile_num 3 "3", modify
    label def cpiquintile_num 4 "4", modify
    label def cpiquintile_num 5 "5", modify
    label def cpiquintile_num 6 "Missing", modify
    label def cpiquintile_num 7 "total", modify

  • #2
    Code:
    capture program drop one_record
    program define one_record
        cii proportions `=denominatorpopulation[1]' `=cases[1]'
        gen incidence = r(proportion)
        gen lb95 = r(lb)
        gen ub95 = r(ub)
        exit
    end
    
    gen `c(obs_t)' record_num = _n
    runby one_record, by(record_num)
    -runby- is written by Robert Picard and me; it is available from SSC.

    This code creates the exact binomial confidence interval, which is the default for the -cii proportions- command. Wald, Wilson, Agresti-Couli, and Jeffreys confidence intervals are also available if you prefer one of those. See -help cii- for details.

    In your example data, it appears that cpiquintile_num and year uniquely identify observations in your data set. If this is the case throughout your data set, then there is no need to create the -record_num_ variable, and you can use -by(cpiquintile_num year)- instead of -by(record_num)- in the -runby- command.

    Comment


    • #3
      Thank you so much. That looks perfect. Much appreciated

      Comment

      Working...
      X