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: tau-c on Stata


From   Steve Samuels <sjsamuels@gmail.com>
To   statalist@hsphsun2.harvard.edu
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.

Steve
sjsamuels@gmail.com


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

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 (http://www.stata.com/statalist/archive/2008-08/msg00300.html) 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


Thomas Didier
McGill University

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index