# st: plot of median bias with CI

 From Lars Korsholm <[email protected]> To [email protected] Subject st: plot of median bias with CI Date Wed, 21 Aug 2002 11:40:24 +0200 (MEST)

```Hi

I have a simulation study where for each value of mu I have 1000
estimates. Mu runs from .01 to .31
The "true" value depends on mu.
its farly easy to plot the median or any other egen-statstics versus mu.
BUT I would like to plot the median _with_ the associated confidense
interval from -centile- (anything better?)

With a -foreach x=1/31 {- loop this i possible
since the values of mu is "nice"
But can it be done smarter/easier/more general?

gen bias=est-true
gen double cen=.
gen double up=.
gen double do=.
forvalues x = 1/31 {
qui centile bias if mu==`x'/100
replace cen=`r(c_1)' if mu==`x'/100
replace up=`r(ub_1)' if mu==`x'/100
replace do=`r(lb_1)' if mu==`x'/100
}

bysort mu: keep if _n==1
gr cen up do mu, c(.||) s(x..) sa(gr1, replace)

best lars

............................................
: Lars Korsholm Ph.D.,                     :
:  Department of Statistics and Demography :
:  University of Southern Denmark          :
:  Sdr. Boulevard 23A, 1.                  :
:  DK-5000 Odense C                        :
: Phone   +45 6550 3608                    :
: Fax     +45 6595 7766                    :
: Mail    [email protected]              :
: Web     http://www.isd.sdu.dk/~korsholm  :
:..........................................:

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