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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

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

Subject |
RE: st: question on xtile using cutpoints |

Date |
Wed, 22 Oct 2008 18:51:49 +0100 |

Terminology aside, my guess is that -xtile- is fairly old and in origin predates numlists. I'd have to rummage in old manuals to be sure. Nick n.j.cox@durham.ac.uk Maarten buis I understand the confusion though, the syntax of -xtile- does not look very Stataish to me (to borrow some Coxish terminology). I would have expected that the cutpoints should be given to -xtile- as a numlist instead of storing these as a variable. Maybe the numlist causes problems if you want to specify a lot of cutpoints, but I don't know. > --- Sharon Kane <spkane@uga.edu> wrote to me privately: > > > Thanks Maarten, that does help some, but here is the rest of the > > specifics. I have two choices for my cutpoints - 1. the original > > variable and 2. the variable containing quintiles 1-5. When I > select > > either of those as my cutpoints for the new variable, the results > are > > strange. Any further suggestions? > > It is usually better to respond to the statalist for reasons > discussed > in section 5 of the statalist FAQ. > > A quick and dirty method is shown in the example below: > > *------------- begin example ------------- > // prepare the data > tempfile benchmark newdata > > sysuse auto, clear > keep if foreign == 0 > save `benchmark' > > sysuse auto, clear > keep if foreign == 0 > save `newdata' > > // collect the cutvalues > use `benchmark', clear > _pctile mpg , nquantile(5) > return list > > // apply these cutvalues to new data > use `newdata', clear > gen bench = . > forvalues i = 1/4 { > replace bench = `r(r`i')' in `i' > } > list bench in 1/10 > xtile newvar = mpg, cutpoints(bench) > tab newvar > tab mpg newvar > *------------- end example ---------------- > (For more on how to use examples I sent to the Statalist, see > http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html ) > * * 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**:**Re: st: question on xtile using cutpoints***From:*Maarten buis <maartenbuis@yahoo.co.uk>

**Re: st: question on xtile using cutpoints***From:*Maarten buis <maartenbuis@yahoo.co.uk>

- Prev by Date:
**Re: st: question on xtile using cutpoints** - Next by Date:
**st: Weighted mean of prices with quantities as weight** - Previous by thread:
**Re: st: question on xtile using cutpoints** - Next by thread:
**st: Weighted mean of prices with quantities as weight** - Index(es):

© Copyright 1996–2015 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |