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

RE: st: Re: requesting help for a newbie


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Re: requesting help for a newbie
Date   Thu, 11 Sep 2003 10:48:59 +0100

Deborah L. Rhodes
 
> My first question: Does categorizing numerical data into 
> quartiles require 
> two steps or one?   The original data(totdolars)is in 
> dollar amounts.
> 
> I have tried to go directly to the quartiles: (using both g 
> and as noted below)
>          xtile totdolarsqtl=totdolars, nquantiles(25);
> 
> I have the same problem if I try pctile to create 
> percentiles to bring to 
> quartiles.  It seems the syntax should be similar.
>          pctile totdolarspc=totdolars, nquantiles(1);
> 
> I have substituted totdolars (my variable with original 
> dollar amount data) 
> for exp, which according to the help file for "creating 
> variables using 
> percentiles" is "typically just another variable."

You are misreading the -nquantiles()- option. Here is 
what the on-line help says: 
 
nquantiles(#) specifies the number of quantiles.  
The command computes percentiles corresponding to 
percentages 100*k/# for k=1, 2, ..., #-1.  For example,
nquantiles(10) requests that the 10th, 20th, ..., 90th 
percentiles be computed. The default is nquantiles(2); 
i.e., the median is computed.

For quartiles specify -nq(4)-: 

. xtile totdolarsqtl = totdolars, nq(4) 

The result is a variable with values 1 to 4, depending 
on where values lie relative to the lower quartile, 
median and upper quartile. All values specified will 
be categorised. 

. pctile totdolarspc = totdolars, nq(4) 

The result is a variable with just 3 [sic] non-missing
values, containing the lower quartile, median and upper 
quartile. That is probably not what you want. 

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