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

st: RE: plot of median bias with CI


From   "Nick Winter" <[email protected]>
To   <[email protected]>
Subject   st: RE: plot of median bias with CI
Date   Wed, 21 Aug 2002 08:15:52 -0400

> -----Original Message-----
> From: Lars Korsholm [mailto:[email protected]] 
> Sent: Wednesday, August 21, 2002 5:40 AM
> To: [email protected]
> Subject: st: plot of median bias with CI
> 
> 
> 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?
> 
> my code reads:
> 
> 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

If you are looking for a more general way to obtain the values of mu,
consider -vallist-, a utility by Nick Cox which does just this.  Or, you
can do it yourself with the tabulate command:

	tab mu , matrow(rows)
	forvalues x= 1/`r(r)' {
		local curmu = rows[`x',1]
		qui centile bias if mu==`curmu'
		...
	}

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