Hello
I wish to calculate incidence rates with 95% confidence intervals for event occurring more than once; e.g. drug prescriptions or hospital admission within a period. In the following example I use the diet example data.
The fail variable contains count of CHD which occurs more than once within the time window.
The obvious go-to command is stptime
But the stset appears to handle the number of failures corresponding to the count of fail!=0 which lead to incidence rates with too few events.
I would rather calculate the incidence rate from the sum of fails
Last time I calculated the incidence rates and 95% confidence intervals manually with the formulas but I guess Stata must have a standardized solution? Preferably a command allowing for stratification and storing the estimates as scalars or matrices. If it makes any difference, I use Stata18.
I wish to calculate incidence rates with 95% confidence intervals for event occurring more than once; e.g. drug prescriptions or hospital admission within a period. In the following example I use the diet example data.
Code:
use https://www.stata-press.com/data/r18/diet.dta, clear
The fail variable contains count of CHD which occurs more than once within the time window.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int id byte(fail month) 1 0 8 2 0 12 3 0 11 4 0 9 5 0 9 6 5 3 7 0 11 8 0 5 9 0 2 10 0 7 11 0 10 12 0 7 13 0 9 14 0 12 15 0 5 16 3 5 17 12 2 18 0 2 19 12 2 20 0 2 end
The obvious go-to command is stptime
Code:
. stset month, id(id) failure(fail) Survival-time data settings ID variable: id Failure event: fail!=0 & fail<. Observed time interval: (month[_n-1], month] Exit on or before: failure -------------------------------------------------------------------------- 337 total observations 0 exclusions -------------------------------------------------------------------------- 337 observations remaining, representing 337 subjects 80 failures in single-failure-per-subject data 2,100 total analysis time at risk and under observation At risk from t = 0 Earliest observed entry t = 0 Last observed exit t = 12 . . stptime Failure _d: fail Analysis time _t: month ID variable: id Estimated person-time and incidence rate Cohort | Person-time Failures Rate [95% conf. interval] -----------+----------------------------------------------------------- Total | 2100 80 .03809524 .0305987 .0474283
But the stset appears to handle the number of failures corresponding to the count of fail!=0 which lead to incidence rates with too few events.
Code:
. count if fail!=0 80
I would rather calculate the incidence rate from the sum of fails
Code:
. tabstat fail month, statistics(sum) Stats | fail month ---------+-------------------- Sum | 674 2100 ------------------------------ . di 674/2100 .32095238
Last time I calculated the incidence rates and 95% confidence intervals manually with the formulas but I guess Stata must have a standardized solution? Preferably a command allowing for stratification and storing the estimates as scalars or matrices. If it makes any difference, I use Stata18.
Comment