[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

# st: Variance of a ratio

 From Leonelo Bautista To statalist@hsphsun2.harvard.edu Subject st: Variance of a ratio Date Fri, 17 Sep 2004 14:32:05 -0500

```I have a variable R that represents the risk of disease in each subject. I
regress this variable against predictors of risk:

regress R sex age obese diabetic

In this model obese and diabetic are dichotomous variables. I want to
calculate the proportion of R that is attributable to obesity (P), after
adjustment by sex, age and diabetes. Therefore, I estimated the predicted R
in the whole population and in those without obesity using adjust:

adjust, gen(adj1 seadj1) se
adjust if obese==0, gen(adj2 seadj2) se

Then, I calculate P:	gen P=(adj1-adj2)/adj1

However, I need to calculate the variance of P. Since P is a ratio, there
seems to be no analytical way to estimate it. Therefore, I made 10000
simulations of P and got the variance from the simulated values, as follows:

gen Ipop = adj1 +  seadj1 * invnorm(uniform())
gen Inull = adj2 +  seadj2'* invnorm(uniform())
gen P = (Ipop-Inull)/Ipop
sum P
gen Pmean=r(mean)   (Mean of P)
gen Pvar=r(Var)	(Var of P)

Is this a reasonable approach?

Thanks!

Leonelo E. Bautista

*
*   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–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index