Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Inverse Cummulative Variable


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   RE: st: Inverse Cummulative Variable
Date   Mon, 12 Mar 2012 15:30:10 +0000

Here's a way of doing it with ranks: 

. sysuse auto, clear 
(1978 Automobile Data)

. gen work = -mpg

. egen work2 = rank(work), unique

. egen cufreq = max(work2), by(work)

. tabdisp mpg, c(cufreq)

----------------------
Mileage   |
(mpg)     |     cufreq
----------+-----------
       12 |         74
       14 |         72
       15 |         66
       16 |         64
       17 |         60
       18 |         56
       19 |         47
       20 |         39
       21 |         36
       22 |         31
       23 |         26
       24 |         23
       25 |         19
       26 |         14
       28 |         11
       29 |          8
       30 |          7
       31 |          5
       34 |          4
       35 |          3
       41 |          1
----------------------

If you were happy with a tabulation alone, -groups- (SSC) offers another way to do this. 

. groups mpg, show(rF) ge sep(0)

  +------------+
  | mpg   # >= |
  |------------|
  |  12     74 |
  |  14     72 |
  |  15     66 |
  |  16     64 |
  |  17     60 |
  |  18     56 |
  |  19     47 |
  |  20     39 |
  |  21     36 |
  |  22     31 |
  |  23     26 |
  |  24     23 |
  |  25     19 |
  |  26     14 |
  |  28     11 |
  |  29      8 |
  |  30      7 |
  |  31      5 |
  |  34      4 |
  |  35      3 |
  |  41      1 |
  +------------+


Nick 
[email protected] 


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
Sent: 12 March 2012 14:33
To: '[email protected]'
Subject: RE: st: Inverse Cummulative Variable

That's clearly right in principle. In practice, -cumul- is I think easier for what was asked for here.

Nick 
[email protected] 

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of David Hoaglin

For the number of firms that have at least as many employees (rather
than the percentage of firms), it should be possible to work with
ranks.

David Hoaglin

On Mon, Mar 12, 2012 at 4:04 AM, Nick Cox <[email protected]> wrote:
> Survivor, survival or reliability function I have often seen for the
> complementary probability. Is it used also for the corresponding
> complementary frequency, which is being sought here?
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index