Bookmark and Share

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]

st: RE: kendall's tau or gamma


From   "Abelev, Melissa - FNS" <Melissa.Abelev@fns.usda.gov>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: kendall's tau or gamma
Date   Mon, 31 Oct 2011 16:03:46 +0000

MODIFIED/CODE ADDED -- I'm trying to construct a crosstab on weighted, ordinal data.  Stata will do the crosstab.  When I try to get the gamma or kendall's tau (or any measures of association), it says "option gamma not allowed" (or substitute "gamma" for any measure I tried).  Why is this?  Can anyone provide some l= ight here?  I just need to be able to say whether or not the variables are = associated, and the strength and direction of the relationship...??

You can see the progression of my code below, with the results.  When I run the tab without the weights, it's fine. 
. tab purchtrxcat bencat, taub
(I get the table with the Kendall's tau below it)

When I add the weights *without* the taub command, it's fine.
.tab purchtrxcat bencat [aweight=fywgt]
(I get a weighted cross-tab)

When I try to weight the data *and* get taub however, I get an error message.
.tab purchtrxcat bencat [aweight=fywgt], taub
(Stata says:)
option taub not allowed
r(198);

So then I tried 
svyset _n [pweight=fywgt], vce(linearized) singleunit(missing)

But in the two-way tables, the only options for measures of association are chi2 and Wald, but I'm not familiar with Wald.

The progression with results follows:
. tab purchtrxcat bencat, taub

purchtrxca |                                    bencat
         t |         1          2          3          4          5          6          7 |     Total
-----------+-----------------------------------------------------------------------------+----------
         1 |       632      1,924        776         95         22          3          5 |     3,457 
         2 |       359      3,935      8,033      1,844      1,315        433        284 |    16,203 
         3 |        12        642      5,186      2,192      2,717      1,450      1,297 |    13,496 
         4 |         0        116      1,799        989      1,792      1,258      1,694 |     7,648 
         5 |         0         31        629        355        781        713      1,346 |     3,855 
         6 |         0         11        350        191        420        512      1,549 |     3,033 
-----------+-----------------------------------------------------------------------------+----------
     Total |     1,003      6,659     16,773      5,666      7,047      4,369      6,175 |    47,692 

          Kendall's tau-b =   0.5282  ASE = 0.003

. tab purchtrxcat bencat [aweight=fywgt]

purchtrxca |                                    bencat
         t |         1          2          3          4          5          6          7 |     Total
-----------+-----------------------------------------------------------------------------+----------
         1 | 556.01411   1,736.72  878.15302  91.446602  38.955687  1.4737055  2.1435293 | 3,304.906 
         2 | 325.32611  3,683.845  8,328.974  1,711.527  1,232.943  384.25979  296.64768 | 15,963.52 
         3 | 10.161731 637.417148   5,407.99  2,087.732  2,750.707  1,452.406  1,223.561 |13,569.975 
         4 |         0  116.30836  1,955.825  876.71062  1,825.956  1,286.674  1,568.736 |  7,630.21 
         5 |         0  37.457129  686.89222  336.23657  893.12914  719.02972  1,313.329 | 3,986.074 
         6 |         0  9.5271419  474.25455  158.99672  502.70048  562.16456  1,529.668 | 3,237.312 
-----------+-----------------------------------------------------------------------------+----------
     Total | 891.50195  6,221.275  17,732.09 5,262.6498  7,244.391  4,406.008  5,934.085 |    47,692 


. tab purchtrxcat bencat [aweight=fywgt], taub
option taub not allowed
r(198);


.

**************
Melissa S. Abelev, Ph.D.
Policy Analyst, Office of Research and Analysis
Food and Nutrition Service, USDA
3101 Park Center Dr., 10th Floor
Alexandria, VA 22302
703-305-2209
melissa.abelev@usda.gov



*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index