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: Kendalls tau-b difference between ktau and tabulate taub


From   "Kornak, John" <[email protected]>
To   "<[email protected]>" <[email protected]>
Subject   Re: st: Kendalls tau-b difference between ktau and tabulate taub
Date   Sat, 25 Jan 2014 17:54:55 +0000

Thanks to Nick Cox and Roberto Ferrer for their super-fast and clear responses to my query!!!

I will summarize here:

Clearly, my issue had been that I had not used tabi in the correct manner. As Nick pointed out:

-ktau- is a command (not a function) which expects sample values.

-tabi- is a command which expects cell frequencies.

Roberto provided the solution that worked correctly. In his solution he tabulated the original data to provide the correct cell frequencies. This contrasts with my original posting where I had input the data as cell frequencies…. doh!

*----------------- begin code -------------------

clear all
set more off

input x y
3 5
6 7
2 3
9 4
7 5
4 2
end

ktau x y, stats(taub se)

tabulate x y, taub

*------------- end code -----------------------

Thanks again!

Cheers,

John

---------------------- Original posting ----------------------------------------


>> Hi Statalist members,
>> 
>> I am trying to figure out why I get different results using the stata function ktau versus tabulate with the taub option.
>> 
>> For example if I have the following dataset
>> 
>> . list
>> 
>>     +-------+
>>     | x   y |
>>     |-------|
>>  1. | 3   5 |
>>  2. | 6   7 |
>>  3. | 2   3 |
>>  4. | 9   4 |
>>  5. | 7   5 |
>>  6. | 4   2 |
>>     +-------+
>> 
>> .
>> 
>> then using ktau I get
>> 
>> . ktau x y, stats(taub se)                      [I have snipped the output to the relevant parts below]
>> 
>> Kendall's tau-b =       0.1380
>>    SE of score =       5.228   (corrected for ties)
>> .
>> 
>> Within tabulate; (tabi 3 6 2 9 7 4\5 7 3 4 5 2, taub) I get
>> 
>> Kendall's tau-b =  -0.1667  ASE = 0.115
>> 
>> If I transpose rows and columns I still get the same (i.e. with tabi 3 5\6 7\2 3\9 4\7 5\4 2, taub)
>> 
>> Even cases like correlating 1,2,...,n with itself (tabi 1 1\2 2\3 3\4 4\ 5 5, taub) in tabulate gives an unexpected answer to me of 0.
>> 
>> I am using Stata 13 on a macbook pro running OS X v. 10.8.5.
>> 
>> Any insights into why I get differing answers would be very much appreciated. I expect I am misinterpreting what taub is supposed to be doing in tabulate.
> 


-- 
John Kornak, PhD
Associate Professor in Residence
Department of Epidemiology and Biostatistics
University of California, San Francisco
UCSF Box 0560
185 Berry Street, Lobby 5, Suite 5700
San Francisco, CA 94107-1762
Tel: 415-514-8028
Fax: 415-514-8150
Email: [email protected]

Cite CTSI  NIH Funding Acknowledgment: Please help us continue our support of clinical & translational research.
Publications supported by CTSI in any way are required to credit the CTSI grant and comply with NIH Public Access Policy.  




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