0
$\begingroup$

stats enthusiasts!

I'm having trouble with a manual calculation of Kendall's tau-b. My result differs from the SPSS output, and I can't figure out where I went wrong. Here's my process:

I'm analyzing the association between exercise levels (0,1,2) and optimism levels (0,1,2) with this data:

Optimism(y): 0,0,0,1,1,1,1,1,2,2,2,2,1,2,1

Exercise(x): 0,0,0,0,0,1,1,1,1,1,2,2,2,2,2

I calculated:

Concordant pairs (C): 49

Discordant pairs (D): 4

Ties in y (Ty): 34

Ties in x (Tx): 30

I used this formula:

τb = (Nc - Nd) / √(Nc + Nd + Tx) * √(Nc + Nd + Ty)

Plugging in the values:

τb = (49 - 4) / √(49 + 4 + 30) * √(49 + 4 + 34) ≈ 0.5295

However, SPSS gives a result of about 0.617.

I've double-checked my calculations for C, D, Tx, and Ty using online calculators(https://statpages.info/ordinal.html), and they seem correct. So, I'm wondering:

Are my parentheses wrong in the formula?

Did I miscalculate concordant or discordant pairs?

Is there an error in my tie calculations?

I'd really appreciate any insights on where I might have gone wrong.

$\endgroup$
2
  • $\begingroup$ It appears SPSS does not correct for ties. $\endgroup$
    – whuber
    Commented Aug 22 at 19:01
  • $\begingroup$ I don't think that's the case: R, which does correct for ties, also gives 0.616 $\endgroup$ Commented Aug 22 at 23:57

1 Answer 1

2
$\begingroup$

SPSS here gives the same as R's cor(, method="kendall"), which says it uses Kendall's $\tau_b$ in the case of ties. Following Wikipedia

> a
 [1] 0 0 0 1 1 1 1 1 2 2 2 2 1 2 1
> b
 [1] 0 0 0 0 0 1 1 1 1 1 2 2 2 2 2
> ta<-table(a)
> sum(ta*(ta-1)/2)->n2
> tb<-table(b)
> sum(tb*(tb-1)/2)->n1
> n0<-n*(n-1)/2
> (49-4)/sqrt((n0-n1)*(n0-n2))
[1] 0.6166698

is the correct value for $\tau_b$.

$\endgroup$
2
  • $\begingroup$ But how would you calculate n1​ and n2 manually in this case? $\endgroup$
    – isaaclt
    Commented Aug 23 at 14:48
  • $\begingroup$ The way i did it? $\endgroup$ Commented Aug 25 at 21:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.