Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: Problem with xtile-command from the egenmore package |
Date | Mon, 11 Feb 2013 23:01:53 +0000 |
This -xtile()- function (not command) in -egenmore- (SSC) was written by Uli Kohler, now at Potsdam. It is a wrapper for calling -_pctile- repeatedly. It doesn't sound wrong that different -by()- calls with different variables give different results. Otherwise I guess that Uli will want to see either a reproducible result or your dataset. Nick On Mon, Feb 11, 2013 at 10:41 PM, "Jürgen Haas" <haasjuergen@gmx.net> wrote: > Hi, > > I analyze a panel dataset that includes the daily market capitalizations of a group of firms. Now, I want to group these firms into deciles based on their market capitalizations on a monthly basis. > > To do so, I use the xtile-command from the egenmore-package. This is my command: > > en month=mofd(date) > egen decile_id = xtile(marketcap), nquantiles(10) by(month) > > For all days of a certain month, a firm should stay in one decile group. However this is not the case. Often, a firm's group changes over the course of a month. > > My first thought was that my command was flawed and calculated deciles on a daily basis. However, using > > egen decile_id = xtile(marketcap), nquantiles(10) by(date) > > delivers a different result and the computation does also take somewhat more time. * * 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/