Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Grace Jessie <gracejessie@hotmail.com> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: How does Stata calculate percentiles? |

Date |
Mon, 25 Oct 2010 13:41:51 +0000 |

Phil, Nick, thank you for further help. Nick, yes, there is loss of information. Thank you for reminder. Grace > Subject: Re: st: How does Stata calculate percentiles? > From: philclayton@internode.on.net > Date: Mon, 25 Oct 2010 17:12:15 +1100 > To: statalist@hsphsun2.harvard.edu > > centile price, centile(`=100/3') > > On 25/10/2010, at 4:05 PM, Grace Jessie wrote: > > > Phil,Nick, > > thank you a lot for replies. > > -centile- works well. > > However, does centile(33) equal to centile 100/3 I want to get? > > Nick, thank you for reminder.I keep the variable and just do some statistics for the variable, so no loss of information. > > Grace > > > > ---------------------------------------- > >> From: n.j.cox@durham.ac.uk > >> To: statalist@hsphsun2.harvard.edu > >> Date: Sun, 24 Oct 2010 17:42:23 +0100 > >> Subject: RE: st: How does Stata calculate percentiles? > >> > >> Phil gave a good answer. However, once you have the -centile- result in memory, > >> > >> local cutpoint=r(c_1) > >> recode price (min/`cutpoint'=0) (`cutpoint'/max=1), gen(pricecat) > >> > >> can be replaced by one line > >> > >> gen pricecat = (price >= r(c_1)) if !missing(price) > >> > >> which yields 0, 1 and numeric missing as appropriate. > >> > >> On the other hand, why do you want to throw away information like this? > >> > >> Nick > >> n.j.cox@durham.ac.uk > >> > >> Phil Clayton > >> > >> One way to do it would be to obtain the centile using the -centile- command, then -recode- the variable to create the indicator variable. > >> > >> Example: > >> sysuse auto > >> centile price, centile(33) > >> local cutpoint=r(c_1) > >> recode price (min/`cutpoint'=0) (`cutpoint'/max=1), gen(pricecat) > >> > >> If you wanted the indicator variable to be 1 if the variable is >= the cutpoint (as opposed to >), swap the two recoding rules (once one rule is matched, the subsequent rules are ignored). > >> > >> See the manual for -centile- to see how it's calculated. It's pretty standard. With regards to "su varname, d", see -help summarize- and the manual for -summarize- > >> > >> On 24/10/2010, at 3:27 PM, Grace Jessie wrote: > >> > >>> I want to generate a new variable equaling 1 if the other variable is greater than its 100/3 percentile and 0 otherwise.How to get the 100/3th percentile of a variable? > >>> And how does Stata calculate percentiles if the number of observations is odd or even? > >>> Additionally, what does the output "smallest and largest" mean after "su varname,d"? > >> > >> * > >> * 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/ > > * > > * 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/ > > > * > * 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/ * * 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/

**References**:**st: How does Stata calculate percentiles?***From:*Grace Jessie <gracejessie@hotmail.com>

**Re: st: How does Stata calculate percentiles?***From:*Phil Clayton <philclayton@internode.on.net>

**RE: st: How does Stata calculate percentiles?***From:*Nick Cox <n.j.cox@durham.ac.uk>

**RE: st: How does Stata calculate percentiles?***From:*Grace Jessie <gracejessie@hotmail.com>

**Re: st: How does Stata calculate percentiles?***From:*Phil Clayton <philclayton@internode.on.net>

- Prev by Date:
**RE: st: ANOVA Posthocs** - Next by Date:
**Re: st: RE: overidentification test after treatreg** - Previous by thread:
**Re: st: How does Stata calculate percentiles?** - Next by thread:
**RE: st: How does Stata calculate percentiles?** - Index(es):