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

st: Re: Simulation


From   "Steichen" <[email protected]>
To   <[email protected]>
Subject   st: Re: Simulation
Date   Mon, 12 Apr 2004 11:59:58 -0400

No need for -simulate-, Leonelo... just do it directly.

Note that there are a number of assumptions about distributions...   I
assume A is normally distributed and the odds ratio, B, is log normal.
Also, I assume that se(B) is really se(log(B)), which is what we usually
have for an OR.

Please note that this approach clears your existing dataset.  Be sure it is
saved before you do this.  Change the -set obs 10000- to whatever size you
want and plug your observed means, se's and K in below that.

You can plot Y after this via
   . histogram Y

Tom

----- leb_sim.do ----------------------------------------------------

clear all

set obs 10000

local meanA = 123
local seA = 3
local meanB = 2.1
local selogB = .5
local K = 4

gen A = `meanA' + `seA' * invnorm(uniform())
gen B = exp( log(`meanB') + `selogB' * invnorm(uniform()) )
gen Y = (A * B) / `K'

sort Y

local l025 = .025 * _N
local u025 = .975 * _N

di "95% CI of Y: (" Y[`l025'] ", " Y[`u025'] ")"

---------------------------------------------------------------------

----- Original Message ----- 
From: "Leonelo Bautista" <[email protected]>
To: <[email protected]>
Sent: Monday, April 12, 2004 11:05 AM
Subject: st: Simulation


> I'm trying to obtain 95% confidence intervals and standard errors from
> the following quantity (Y):
>
> Y= (A x B)/K
>
> Where, A is the mean of a continuous variable; B is an odds ratio; and K
> is a constant. A and B are calculated from published reports, and I can
> only obtain their standard error (SE) from the reported 95% confidence
> interval. Therefore, I have A and SE(A), B and SE(B), and K.
>
> I've checked the "simulate" command, but I'm not savvy enough to write a
> do file to accomplish this task. Any help or suggestion would be
> appreciated.
>
>
> Leonelo E. Bautista, MD, DrPH
> Assistant Professor
> University of Wisconsin Medical School
> Population Health Sciences
> 610 Walnut Street, 703 WARF
> Madison, WI 53726-2397
> Phone: (608)265-6176
> Fax: (608)263-2820
>
>
>
> *
> *   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/
>

*
*   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