Library: | stats |
See also: | relation relationchi2 relationcorrcont relationrank relationcorr |
Quantlet: | relationcont | |
Description: | Computes the contingency coefficient for discrete data. |
Usage: | rel = relationcont (x {, colname {, opt}}) | |
Input: | ||
x | n x p matrix of p variables, each with n observations | |
colname | p x 1 text vector with names of x variables | |
opt | q x 1 text vector of optional parameters | |
Output: | ||
rel.r | p x p matrix of contingency coefficients | |
rel.pval | p x p matrix, significance level of chi^2 statistics |
; loads the library stats library("stats") ; read swiss banknote data ; actually these data are continuous, but the first ; three variables have approx. 20 realizations x = read("bank2") ; compute the contingency coefficients and the pvalues ; of the chi^2 statistic automatically colname = string("X%0.f", 1:cols(x)) relationcont(x, colname, "automatic")
Contents of rel.r [1,] 0.9759 0.79389 0.82923 0.91683 0.87316 0.91154 [2,] 0.79389 0.97014 0.83826 0.89561 0.86044 0.88327 [3,] 0.82923 0.83826 0.97333 0.9078 0.86546 0.89209 [4,] 0.91683 0.89561 0.9078 0.98995 0.94851 0.95438 [5,] 0.87316 0.86044 0.86546 0.94851 0.98561 0.94309 [6,] 0.91154 0.88327 0.89209 0.95438 0.94309 0.98802 Contents of rel.pval [1,] 0 0.20152 0.0024184 0.048822 +NAN 7.3697e-05 [2,] 0.20152 0 3.8681e-11 0.2472 0.21048 0.071514 [3,] 0.0024184 3.8681e-11 0 0.096837 +NAN 0.1404 [4,] 0.048822 0.2472 0.096837 0 0.015248 0.29226 [5,] +NAN 0.21048 +NAN 0.015248 0 5.1065e-05 [6,] 7.3697e-05 0.071514 0.1404 0.29226 5.1065e-05 0