Bookmark and Share

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

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

Re: st: tau-c on Stata

From   Steve Samuels <>
Subject   Re: st: tau-c on Stata
Date   Tue, 29 May 2012 23:01:54 -0400

The post you referred to was from Roger Newson.
Here's a bootstrapped version of Roger's code.


**************CODE BEGINS*************
capture program drop _all
program define tauc, rclass
syntax varlist(min=2 max=2) [if] [in]
if  `"`1'"'== `"`2'"' {
     di as error "Error: Two different variables required"
     exit 102
tempname v1 v2 m1 m2 m score N tauc
gen `v1' = `1'
gen `v2' = `2'
sum `v1'
tab `v1' if !missing(`v2')
scal `m1'=r(r)
tab `v2' if !missing(`v1')
scal `m2'=r(r)
scal `m'=min(`m1',`m2')
qui ktau `v1' `v2'
return list
scalar `score'=r(score)
scal `N'=r(N)
local tauc= `score'*(2*`m'/(`N'^2*(`m'-1)))
return scalar tau_c = `tauc'

sysuse auto, clear
bootstrap tau_c = r(tau_c), reps(50): tauc trunk foreign
estat bootstrap, all

***************CODE ENDS************

On May 29, 2012, at 8:53 PM, Thomas Didier wrote:

Dear Stata Users,

Is there a command or a plug-in for Stata to estimate Kendall tau-c? A response to a 2008 question ( provided a "manual" way to make the calculation; this works but takes some time and doesn't provide a level of statistical significance (ASE). Apparently tau-c is a routine estimation on SPSS and I hope I can find an equivalent on Stata.

Many thanks for your help,

Thomas Didier
McGill University

*   For searches and help try:

*   For searches and help try:

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