Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Syed Basher <syed.basher@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: On the joint frequency distribution |
Date | Sat, 30 Nov 2013 00:02:34 +0300 |
Hi Richard, thank you for your prompt reply. The choice of 10 bins is purely arbitrary. It could be any value between 6-10 (as seen in the literature), or any other figure. Say, X is US stock return and Y is Japanese stock return, by calculating the joint distribution of (i,j) cells, we can understand the dependence structure of the two return series, whereby numbers in bin (1,1) represent the left tail while the numbers in bin (10,10) represent the right tail. I tried the syntax you suggested (without doing the re-labeling), the off-diagonal elements are zero. Is it because of not doing the re-labeling? Syed On Fri, Nov 29, 2013 at 11:14 PM, Richard Goldstein <richgold@ix.netcom.com> wrote: > it is not at all clear why you want to do this, (do you have too many > distinct values for a cross-tab? why 10 groups?, etc.) but here is, I > think, a specific answer to your question: > > sort X > egen xcat=cut(X), group(10) > sort Y > egen ycat=cut(Y), group(10) > ta xcat ycat > > you might want to re-label the new variables > > Rich > > On 11/29/13, 2:45 PM, Syed Basher wrote: >> Dear Stata Users, >> >> I am using Stata 12.1. I have two series X and Y (2280 obs each). I >> want to compute the joint frequency distribution of the two variables >> (i.e., cross tabulation). First, I want to sort the variables in >> ascending order. Second, I would like to divide each series evenly >> into 10 bins. Finally, I want to get the joint frequency distribution >> of the two series for all combination of (i,j) cells (that is, the >> diagonal and off-diagonal elements). Problem is how can I do this in >> Stata. Your help, hint or suggestion is highly appreciated. >> >> Regards, >> Syed Basher >> Doha, Qatar > * > * 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/ * * 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/