Displaying 1 result from an estimated 1 matches for "goodobs".
Did you mean:
ngoodobs
2011 Jan 21
0
Possible bug in Spearman correlation with use="pairwise.complete.obs"
...n correlation, we do NOT get the same results
> cor( x, y, method="spearman", use="complete.obs" )
[1] 0.3416009
> cor( x, y, method="spearman", use="pairwise.complete.obs" )
[1] 0.3333333
To see the likely reason for this possible bug, observe:
> goodobs <- !is.na(x) & !is.na(y)
> cor( rank(x)[goodobs], rank(y)[goodobs] )
[1] 0.3416009
> cor( rank(x[goodobs]), rank(y[goodobs]) )
[1] 0.3333333
I would claim that only the calculation resulting in 0.3333 is a proper
Spearman correlation, while the line resulting in 0.3416 is not. After...