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   "Dr. Yu Chen" <[email protected]>
To   [email protected]
Subject   Re: st: bug in -xtile-
Date   Thu, 31 Jan 2013 21:21:56 -0600

Nick, if this is -xtile- point of view, then it will not work if I
delete observations whose value<5000. See my code below.
In other words, in the first example I added an if condition, and in
the second example, I deleted those observations. Why is the result
different? I think this is an inconsistency in -xtile-.

sysuse auto,clear
keep in 1/10
drop if price<5000
xtile decile=price , nq(10)




On Thu, Jan 31, 2013 at 8:08 PM, Nick Cox <[email protected]> wrote:
> 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/



-- 
Yu Chen, Ph.D.
Assistant Professor of Accounting
A. R. Sanchez, Jr. School of Business, WHTC 218D
Texas A&M International University
5201 University Boulevard
Laredo, Texas 78041-1900
USA
956-326-2513 (office)
956-326-2479 (fax)
*
*   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