Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: kendall tau c


From   "Newson, Roger B" <[email protected]>
To   <[email protected]>
Subject   st: RE: kendall tau c
Date   Fri, 8 Aug 2008 13:13:58 +0100

According to
http://www2.chass.ncsu.edu/garson/pa765/assocordinal.htm
Stuart's tau-c is equal to
(P - Q)*(2m/(n^2(m-1)))
where P is the number of concordant pairs, Q is the number of discordant
pairs, n is the sample number and m is the number of rows or columns,
whichever is smaller. The quantily P-Q is saved by ktau as r(score), and
the number of distinct values of a variable is saved by tabulate as
r(r). Therefore, Stuart's tau-c between trunk space and foreign origin
can be calculated in the auto data as listed below.

I hope this helps.

Best wishes

Roger


**** BEGINNING OF Stata OUTPUT - CUT HERE
. sysuse auto, clear
(1978 Automobile Data)

. tab trunk if !missing(foreign)

Trunk space |
  (cu. ft.) |      Freq.     Percent        Cum.
------------+-----------------------------------
          5 |          1        1.35        1.35
          6 |          1        1.35        2.70
          7 |          3        4.05        6.76
          8 |          5        6.76       13.51
          9 |          4        5.41       18.92
         10 |          5        6.76       25.68
         11 |          8       10.81       36.49
         12 |          3        4.05       40.54
         13 |          4        5.41       45.95
         14 |          4        5.41       51.35
         15 |          5        6.76       58.11
         16 |         12       16.22       74.32
         17 |          8       10.81       85.14
         18 |          1        1.35       86.49
         20 |          6        8.11       94.59
         21 |          2        2.70       97.30
         22 |          1        1.35       98.65
         23 |          1        1.35      100.00
------------+-----------------------------------
      Total |         74      100.00

. scal m1=r(r)

. tab foreign if !missing(trunk)

   Car type |      Freq.     Percent        Cum.
------------+-----------------------------------
   Domestic |         52       70.27       70.27
    Foreign |         22       29.73      100.00
------------+-----------------------------------
      Total |         74      100.00

. scal m2=r(r)

. scal m=min(scalar(m1),scalar(m2))

. scal list m
         m =          2

. ktau foreign trunk

  Number of obs =      74
Kendall's tau-a =      -0.1984
Kendall's tau-b =      -0.3164
Kendall's score =    -536
    SE of score =     168.377   (corrected for ties)

Test of Ho: foreign and trunk are independent
     Prob > |z| =       0.0015  (continuity corrected)

. retu list

scalars:
                  r(N) =  74
              r(tau_a) =  -.1984450203628286
              r(tau_b) =  -.3163744817891109
              r(score) =  -536
           r(se_score) =  168.37741672003
                  r(p) =  .0014860924283953

. scal score=r(score)

. scal N=r(N)

. scal tauc= scalar(score)*(2*scalar(m)/(scalar(N)^2*(scalar(m)-1)))

. scal list tauc
      tauc = -.39152666
**** END OF Stata OUTPUT - CUT HERE


Roger B Newson
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: [email protected] 
Web page: www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/pop
genetics/reph/

Opinions expressed are those of the author, not of the institution.

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Maria Ziegler
Sent: 07 August 2008 13:34
To: [email protected]
Subject: st: kendall tau c

We wanted to calculate kendall's tau c. Stata seems only to provide tau
a
and tau b with the command ktau. Does anybody know how to calculate tau
c?

Thank you very much for your help!

Maria


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

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index