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.

# Re: st: How can I get the concordant/tie/non-concordant percentage?

 From "Joseph Coveney" To Subject Re: st: How can I get the concordant/tie/non-concordant percentage? Date Sat, 11 Sep 2010 18:46:10 +0900

```Dr. Bartus wrote:

Tamas

On 10/09/10, Karen Lin wrote:
Hi,
Does any one know that in the logistic regression in STATA, how can I generate
the concordant/tie/non-concordant percentage as SAS did? I need this statistics
because my referee asked for it.

--------------------------------------------------------------------------------

I suspect that -compare- doesn't do what she needs.

Using the example at www.ats.ucla.edu/stat/sas/output/sas_logit_output.htm
for SAS's PROC LOGISTIC output, the do-file below might get closer.

Notes:

1. I let -ktau- compute the Percent Ties for me.

2. -somersd- is written by Roger Newson; you'll need to install it from SSC.

3. -somersd- can also compute tau-a and c.

Joseph Coveney

==========

version 11.1

set more off
use http://www.ats.ucla.edu/stat/stata/notes/hsb2, clear
generate byte honcomp = (write >= 60)
logistic honcomp i.female c.(read science), nolog
predict double pr, pr

*
* Percent ties
*
ktau pr pr
display in smcl as text 100 * (1 - r(tau_a))

*
* Percent concordant, discordant
*
sort honcomp pr

local concordant 0
local discordant 0
local total 0

quietly count if !honcomp
forvalues reference_row = 1/`=r(N)' {
forvalues comparison_row = `=r(N) + 1' / `=_N' {
local ++total
local test = sign(pr[`reference_row'] - pr[`comparison_row'])
if `test' < 0 {
local ++concordant
}
else if `test' > 0 {
local ++discordant
}
else {
// no op
}
}
}
display in smcl as text `total'
display in smcl as text 100 * `concordant' / `total'
display in smcl as text 100 * `discordant' / `total'

*
* The other things in SAS's printout
*
somersd honcomp pr
quietly tabulate pr honcomp, gamma
display in smcl as text r(gamma)
ktau honcomp pr, stats(taua)
roctab honcomp pr

exit

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