Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: On the joint frequency distribution


From   Richard Goldstein <[email protected]>
To   [email protected]
Subject   Re: st: On the joint frequency distribution
Date   Fri, 29 Nov 2013 15:14:58 -0500

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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index