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

Re: st: RRR with CI from logit model

From   Michael Ingre <>
Subject   Re: st: RRR with CI from logit model
Date   Wed, 3 Nov 2004 09:38:19 +0100

On 2004-11-02, at 19.02, Leonelo Bautista wrote:

I understand you can get the log of the risk for each group (lnR1 and lnR2,
for example) and their corresponding standard errors (se_lnR1 and se_lnR2).
Consider the following approach:

a) Get a large number of values from the distribution of the risk in each
group using the -uniform- function:
gen A = lnR1 + se_lnR1 * invnorm(uniform())
gen B = lnR2 + se_lnR2 * invnorm(uniform())

b) Calculate the relative risk using A and B
gen rrisk=A/B

c) get the values corresponding to the 0.025 and 0.975 percentiles of the
distribution of "rrisk"
local l025 = .025 * _N
local u025 = .975 * _N

These two values should correspond to a 95% confidence interval for the
relative risk. Maybe other members of the list could comment on the
appropriateness of this approach.

I hope this help,
This is a very neat solution. I will try it today and see how it performs. To me it looks like a feasible "bootstrap" approach. But then, I'm not a statistician. I think though that the code needs to be slightly modified to describe risks:

gen random_a = log_odds_se * invnorm(uniform())
gen random_b = log_odds_se * invnorm(uniform())
gen risk_a = exp(log_odds_a + random_a) / (1 + exp(log_odds_a + random_a))
gen risk_b = exp(log_odds_b + random_b) / (1 + exp(log_odds_b + random_b))


* For searches and help try:

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