Bookmark and Share

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, is already up and running.

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

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:

What about the compare command?


On 10/09/10, Karen Lin wrote:
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 
for SAS's PROC LOGISTIC output, the do-file below might get closer.  


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


*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index