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: relation relationcont relationcorrcont relationrank relationcorr

Quantlet: relationchi2
Description: Computes the Chi^2 coefficients for discrete data.

Usage: rel = relchi2 (x {, colname {, opt})
Input:
x n x p variables
colname n x p variable names
opt q x 1 text vector of optional parameters
Output:
rel.r p x p matrix of chi^2 values
rel.pval p x p significance level of chi^2 statistics

Note:

Example:
; 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 chi^2 statistic and its pvalues
; automatically
colname = string("X%0.f", 1:cols(x))
relationchi2(x, colname, "automatic")

Result:
Contents of rel.r
[1,]     4000   340.93   440.24   1054.5   641.76   982.71
[2,]   340.93     3200   472.66   810.69   570.29   709.79
[3,]   440.24   472.66     3600   937.03   596.87   779.53
[4,]   1054.5   810.69   937.03     9800   1793.3   2043.2
[5,]   641.76   570.29   596.87   1793.3     6800   1608.6
[6,]   982.71   709.79   779.53   2043.2   1608.6     8200

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



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