Announcement

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

  • NBReg - How to calculate difference between two incidence rates

    Hi,

    I want to know if it's possible to calculate the difference in two incidence rates from a negative binomial regression? We are wanting a measure of absolute (not relative) difference between two time points (26 and 60 - identified as the sequence variable here). This would be the difference (with 95% C.I.'s) between the two values generated by the margins command below (i.e. 7.23 - 1.37 = 5.86). I have figured out how to calculate the relative change with the lincom command but can't see how to do this for the difference. Any help would be appreciated.

    Thank you.

    Some sample date is provided.

    Code:
    nbreg n seq, exposure(popn) dispersion(mean) irr 
    margins, at(seq=(26 60)) exp(predict(ir)*100000)
    
    lincom _cons + 26*seq, irr // IR at seq = 26
    lincom _cons + 60*seq, irr // IR at seq = 60
    lincom _cons + 60*seq - _cons - 26*seq, irr // IRR for seq 26 -> seq 60
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input byte month int year float(seq n) double popn
     1 2011  1     11 5193457
     2 2011  2     29 5193457
     3 2011  3     83 5193457
     4 2011  4     22 5217264
     5 2011  5     20 5217264
     6 2011  6     46 5217264
     7 2011  7     19 5245972
     8 2011  8     27 5245972
     9 2011  9     21 5245972
    10 2011 10     18 5269429
    11 2011 11     22 5269429
    12 2011 12     44 5269429
     1 2012 13     14 5302688
     2 2012 14     37 5302688
     3 2012 15     42 5302688
     4 2012 16     55 5329763
     5 2012 17     66 5329763
     6 2012 18     59 5329763
     7 2012 19     23 5363139
     8 2012 20     32 5363139
     9 2012 21     46 5363139
    10 2012 22     55 5397799
    11 2012 23     41 5397799
    12 2012 24     41 5397799
     1 2013 25     41 5447630
     2 2013 26     30 5447630
     3 2013 27     29 5447630
     4 2013 28     23 5481356
     5 2013 29     46 5481356
     6 2013 30     44 5481356
     7 2013 31    108 5519750
     8 2013 32    117 5519750
     9 2013 33    182 5519750
    10 2013 34     97 5686981
    11 2013 35    142 5686981
    12 2013 36    142 5686981
     1 2014 37    217 5741247
     2 2014 38    162 5741247
     3 2014 39    262 5741247
     4 2014 40 225.75 5779641
     5 2014 41 292.75 5779641
     6 2014 42    207 5779641
     7 2014 43 288.25 5820836
     8 2014 44 215.75 5820836
     9 2014 45 200.75 5820836
    10 2014 46  239.5 5852229
    11 2014 47 193.25 5852229
    12 2014 48 238.25 5852229
     1 2015 49  209.5 5903810
     2 2015 50 303.25 5903810
     3 2015 51 338.25 5903810
     4 2015 52 548.25 5938587
     5 2015 53 238.25 5938587
     6 2015 54 223.25 5938587
     7 2015 55 230.75 5982816
     8 2015 56    462 5982816
     9 2015 57 448.25 5982816
    10 2015 58  229.5 6016309
    11 2015 59    187 6016309
    12 2015 60 188.25 6016309
    end

  • #2
    Add the -pwcompare- option to your -margins- command.

    Comment


    • #3
      Thanks Clyde,
      I'm relatively new to Stata and the margins command and clearly need to invest some time in learning more about it. For some reason I thought pwcompare was intended for use with factor variables. Thanks again.

      Comment

      Working...
      X