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

RE: st: RE: Percentiles: Identify of smallest observation closet to percentile value


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: Percentiles: Identify of smallest observation closet to percentile value
Date   Mon, 3 Feb 2003 10:59:43 -0000

Rod Hunter
>
> A simple eg. will suffice.
>
> Obs. Var1
> ----------
> 1     	10
> 2	9
> 3	8
> 4	7
> -----------
>
> I would like Stata to tell me the value of the observation
> that is at or
>   below the 75th percentile point, and to yield the identity (or
> identities) of the observation(s).

I'll change your example. I don't know about "below". ~ 75% are
below; do you what them all?

. use auto
. centile rep78 , c(75)

                                                       -- Binom.
Interp. --
    Variable |     Obs  Percentile      Centile        [95% Conf.
Interval]
-------------+--------------------------------------------------------
-----
       rep78 |      69         75             4               4
5

. ret li

scalars:
            r(n_cent) =  1
                 r(N) =  69
              r(ub_1) =  5
              r(lb_1) =  4
               r(c_1) =  4

macros:
          r(centiles) : "75"

. list rep78 if rep78 == `r(c_1)'

     +-------+
     | rep78 |
     |-------|
  5. |     4 |
 15. |     4 |
 24. |     4 |
 29. |     4 |
 30. |     4 |
     |-------|
 33. |     4 |
 35. |     4 |
 38. |     4 |
 47. |     4 |
 55. |     4 |
     |-------|
 56. |     4 |
 58. |     4 |
 59. |     4 |
 62. |     4 |
 63. |     4 |
     |-------|
 70. |     4 |
 72. |     4 |
 73. |     4 |
     +-------+
Nick
[email protected]

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