Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: stats
See also: relationcorr relationchi2 relationcont relationcorrcont relationrank

Quantlet: relation
Description: Computes the relation coefficients (chi^2, contingency, corrected contingency, spearman rank, bravais-pearson) for the data x.

Usage: rel = relation (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 correlation coefficients
rel.pval p x p pvalues of an appropriate statistic

Note:

Example:
; loads the library stats
library("stats")
; read swiss banknote data
x = read("bank2")
; compute the correlation coefficients
colname = string("X%0.f", 1:cols(x))
relationcorr(x, colname, "automatic"|"Bravais-Pearson")

Result:
Contents of rel.r;
[1,]        1  0.23129  0.15176  -0.1898 -0.061321   0.1943
[2,]  0.23129        1  0.74326  0.41378  0.36235 -0.50323
[3,]  0.15176  0.74326        1  0.48676  0.40067 -0.51648
[4,]  -0.1898  0.41378  0.48676        1  0.14185 -0.62298
[5,] -0.061321  0.36235  0.40067  0.14185        1 -0.59404
[6,]   0.1943 -0.50323 -0.51648 -0.62298 -0.59404        1

Contents of rel.pval;
[1,]        0  0.00098331  0.031935  0.0071053  0.38834  0.0058347
[2,]  0.00098331        0        0  1.1275e-09  1.3454e-07  3.0864e-14
[3,]  0.031935        0        0  2.7089e-13  4.1282e-09  4.885e-15
[4,]  0.0071053  1.1275e-09  2.7089e-13        0  0.045109        0
[5,]  0.38834  1.3454e-07  4.1282e-09  0.045109        0        0
[6,]  0.0058347  3.0864e-14  4.885e-15        0        0        0



Author: S. Klinke, 19970820
(C) MD*TECH Method and Data Technologies, 05.02.2006