Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Underlying distribution for CI's in dstdize


From   May Boggess <[email protected]>
To   [email protected]
Subject   Re: st: Underlying distribution for CI's in dstdize
Date   14 Jul 2004 13:05:42 -0500

On Wednesday, David wrote:

> I am using the dstdize command to calculate age-standardize death
> rates based on a standard population.
> 
> Does anyone know what the underlying distribution for the standard
> error and confidence intervals is using the dstdize command?  I assume
> it is a binomal distribution but would like some confirmation.

The formula for the standard error of the standardized rate used by
-dstdize- is in Greenland and Rothman, page 263,
equation 15-7. There it says that by making the binomial assumption,
we end up with equation 15-9. The only difference between what -dstdize-
and equation 15-9, is that -dstdize- used n_i in the denominator, rather
than n_i-1.You can see this by comparing equation 15-9 with the formula
in the manual [R] dstdize (page 299).  

Let's check this with some examples. First a very easy one:

 clear
 set obs 1
 gen deaths =50
 gen pop=100
 gen one=1
 gen strata=1
 dstdize deaths pop strata, by(one) 
 di "std err= " sqrt(1^2*0.5*(1-0.5)/100)
 di "lb = " 0.5 - invnorm(0.975)*sqrt(0.5*(1-0.5)/100)
 di "ub = " 0.5 + invnorm(0.975)*sqrt(0.5*(1-0.5)/100)

This answers David's question too, by showing that the confidence
interval is formed by using the normal approximation.

Notice that all the numbers we have used in the formula for the standard
error are in the table displayed by -dstdize-. The weight=1 is in the 
5th column called "Std. Pop. Dst[P].". The adjusted rate = 0.5
is in the 4th column called "Stratum Rate(s)". The pop=100 is first on
the left, called pop. 

Another example:

 clear
 set obs 2
 gen deaths =50 in 1
 replace deaths = 20 in 2
 gen pop=100 in 1
 replace pop=100 in 2
 gen strata=_n
 gen one=1
 dstdize deaths pop strata, by(one) 
 di "piece = (wei)^2 *adj_rate*(1-adj_rate)/pop"
 local piece1= (0.5)^2 *0.5*(1-0.5)/100
 local piece2= (0.5)^2 *0.2*(1-0.2)/100
 di "piece1 = " `piece1'
 di "piece2 = " `piece2'
 local sterr =  sqrt(1/(0.5+0.5)*(`piece1'+`piece2'))
 di "st err = " `sterr'
 di "lb = " 0.350000 - invnorm(0.975)*`sterr'
 di "ub = " 0.350000 + invnorm(0.975)*`sterr'


> Also, some of my event counts are less than 100, necessitating a
> Poisson distribution for the CI's for these rates instead of a binomial
> distribution.  Can dstdize be used or modified to determine such rates
> (i.e. has someone written code for this), or would I have to calculate
> these myself using the standard equations?
> 
You could go through the same process as above, but itstead
of using r(1-r)/n for the variance, just use r. Here is an example:

 clear
 set obs 2
 gen deaths =50 in 1
 replace deaths = 5 in 2
 gen pop=100 in 1
 replace pop=25 in 2
 gen strata=_n
 gen one=1
 dstdize deaths pop strata, by(one) 
 local piece1= (0.8)^2 *0.5/100
 local piece2= (0.2)^2 *0.2/25
 local sterr=  sqrt(1/(0.8+0.2)*(`piece1'+`piece2'))
 di "poisson sterr = " `sterr'
 di  "~pop = " 0.44/.05932959^2
 cii 125 55, poisson

The only trick is as the end, how to get the confidence interval from
the rate and the standard error. I said, well, figure out the population
that you would have to have in order to get that rate and the standard
error. Then put that into -cii-. (In my example that turned out to be
exactly the same is if I hadn't stratified, but I suppose that is not
true in general.)

--May
 [email protected]


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index