Library: | stats |
See also: | relation relationchi2 relationcont relationcorrcont relationcorr |
Quantlet: | relationrank | |
Description: | Computes the rank correlation of spearman for ordinal data. |
Usage: | rel = relationrank (x {, colname {, opt}}) | |
Input: | ||
x | n x p variables | |
colname | p x 1 text vector of names of x variables | |
opt | q x 1 text vector of optional parameters | |
Output: | ||
rel.r | p x p matrix of rank correlation coefficients | |
rel.pval | p x p unused (filled with NaNs) |
; loads the library stats library("stats") ; read swiss banknote data x = read("bank2") ; compute the rank correlation coefficients colname = string("X%0.f", 1:cols(x)) rel = relationrank(x, colname, "automatic") rel.r
Contents of r; [1,] 1 0.2256 0.10803 -0.18962 -0.050143 0.22878 [2,] 0.2256 1 0.75063 0.42721 0.36966 -0.48552 [3,] 0.10803 0.75063 1 0.52009 0.42863 -0.50498 [4,] -0.18962 0.42721 0.52009 1 0.16893 -0.60763 [5,] -0.050143 0.36966 0.42863 0.16893 1 -0.58344 [6,] 0.22878 -0.48552 -0.50498 -0.60763 -0.58344 1