Statalist The Stata Listserver


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

Re: st: RE: finding a value from a distribution based on percentile


From   Shuaizhang Feng <[email protected]>
To   [email protected]
Subject   Re: st: RE: finding a value from a distribution based on percentile
Date   Mon, 19 Mar 2007 19:03:40 -0700 (PDT)

thank you.

Shuaizhang

--- Austin Nichols <[email protected]> wrote:

> Shuaizhang Feng--
> Ignoring the bad idea that imputing in this way
> might be, and assuming
> that the "predicted percentiles" are in the set
> {1/100, ... 99/100},
> you might try this:
> 
> clear
> input y x
> 200   .
> 100   .
> .    0.5
> .    0.1
> 234  .
> end
> gen yi=y
> gen oldobs=_n
> gsort -yi, mf
> gen newobs=_n
> su newobs if mi(yi)
> forv i=1/`r(max)' {
>  _pctile y, nq(100)
>  qui replace yi=r(r`=int(x[`i']*100)') in `i'
> }
> sort oldobs
> drop oldobs newobs
> li
> 
> Note also that _pctile allows weights.
> 
> On 3/19/07, Shuaizhang Feng <[email protected]>
> wrote:
> > The real situation I am facing is: I have a
> variable y
> > which has certain values missing, I would like to
> > impute the missing values based on a predicted
> > percentil.  So the x variable contains a
> percentile
> > that I will use to forecast the y variables for
> those
> > missing.
> >
> > Example:
> > y     x
> > 200   .
> > 100   .
> > .    0.5
> > .    0.1
> > 234  .
> >
> > How can I assign a value for those missing y(s)
> based
> > on the perceniles from x?
> >
> > In this example, I guess the y value corresponding
> to
> > x=0.5 is 200 and for x=0.1 is 100.  Note I am
> using
> > the distribution of y only for those observed.
> *
> *   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/
> 



 
____________________________________________________________________________________
We won't tell. Get more on shows you hate to love 
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265 
*
*   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