Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Spearman rank correlation

From   "Jens M. Lauritsen" <[email protected]>
To   [email protected]
Subject   st: Spearman rank correlation
Date   Fri, 30 Aug 2002 11:24:54 +0200

Does anyone have good references for INTERPRETATION in relation to size of
the spearman correlation coefficient. 

For a certain project we had to do many tables of these estimates and I
produced a wrapper for the  ci2 (by Poul Seek) and the spearman commands
one can get this output, which is easy to convert to a table in word by
copy and paste, plus select the output as a block and "convert to text". 

If you dislike the ";" (e.g. because you are not a word user) the just omit
that part. 

The same principle can be suded for any procedure where you want only
estimates (here r(N) etc) and not the remaining texts of that command. The
reason for "version 6" is that ci2 works only in version 6. 

* ---- do file cut from here ----------------
* rank correlations for ebra-rsa project
* author JM. Lauritsen 30 08 2002
program define spearjl
version 6
syntax varlist
local t = "`varlist'"
 di "`varlist'" _c
  qui	   ci2 `varlist' , sp
 di ";" %5.0f r(n) ";" %5.2f r(r) ";" %5.2f  r(lb) "-" %5.2f r(ub) ";" _c
   qui    spearman `t'
 di %10.4f r(p)

use ebra

gen ebraoom = (ebraoo + ebraoo2)/2
gen ebratpm = (ebratp + ebratp2)/2
gen ebraboth = (ebraoom + ebratpm)/2

noi di "Spearman Correlation coefficients"
noi di " ; N  ;   Sp  ;   95% CI  ;   P "
noi spearjl ebraoo ebraoo2
noi spearjl ebratp ebratp2
noi spearjl ebraoom ebratpm
noi spearjl ebraoom rsa
noi spearjl ebratp rsa
noi spearjl ebraboth rsa
* ---- do file cut to here ----------------

Kind regards

Jens M. Lauritsen, Consultant,MD. PhD.
Accident Analysis Group, Odense University Hospital, 
Odense, Denmark e-mail: [email protected]
Initiator of EpiData for DataEntry in windows (EpiInfo V6 principle)
Http:// Sign on for news at:
Phone +45 6541 2293 Mobile +45 2173 2293 fax: +45 6613 6581 
*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index