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: bug in -xtile-


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: bug in -xtile-
Date   Fri, 1 Feb 2013 02:08:55 +0000

In your example 6 values qualify as < 5000. -xtile- classifies into 10
classes as best it can

(Here -groups- is from SSC.)

. groups price decile, sep(0)

  +----------------------------------+
  | price   decile   Freq.   Percent |
  |----------------------------------|
  | 3,799        1       1     16.67 |
  | 4,082        2       1     16.67 |
  | 4,099        4       1     16.67 |
  | 4,453        6       1     16.67 |
  | 4,749        7       1     16.67 |
  | 4,816        9       1     16.67 |
  +----------------------------------+

You seem to be saying that they should not be classified if there are
less than 10. That's a point of view, but it is not -xtile-'s point of
view.

The values are of the new variable are not equally spaced integers,
but they could not be given the request.

Nick

On Fri, Feb 1, 2013 at 1:45 AM, Dr. Yu Chen <[email protected]> wrote:
> I think there is a bug in -xtile-. I ran the code below, and I still
> got deciles, but they are incomplete. I would expect missing values
> because there are not enough observations.
> I use Stata 12.
>
> sysuse auto,clear
> keep in 1/10
> xtile decile=price if price<5000, nq(10)
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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