(42S) (DM42) CHI²-Test for the statistical independence of two classified variables.
02-09-2020, 03:10 PM (This post was last modified: 02-09-2020 03:20 PM by rawi.)
Post: #1
 rawi Member Posts: 81 Joined: Nov 2019
(42S) (DM42) CHI²-Test for the statistical independence of two classified variables.
Program CHIT (uses program “CHIX” for integration of CHI²-distribution).
Input: Matrix of absolute frequencies (has to be in X-register)
Output: Z-register: Degrees of freedom for CHI² distributuion
Y-register: CHI² value
X-register: Confidence level of test
Matrix of absolute frequencies: FTR
Matrix of absolute frequencies in case of independence: FTI

Example: (Werner Voß (editor): Taschenbuch der Statistik, Leipzig 2000, p. 449f):
1000 people were asked what party they would vote for. The absolute frequencies were as follows:
Party female male
SPD 200 170
CDU/CSU 200 200
Grüne 45 35
FDP 25 35
PDS 20 30
Other 30 10

Result:
Z: 5 (degrees of freedom)
Y: 15.7743 (CHI²-value)
X: 0.9925 (The hypothesis of the independence of party an gender can be rejected with a confidence level of 99,25%)

Matrix FTI:
192.4 177.6
208 192
41.6 38.4
31.2 28.8
26 24
20.8 19.2

Note: All elements of the matrix FTI should be > 5. Otherwise the approximative use of the CHI² distribution is not valid.

Enjoy
Raimund Wildner

{ 109 - Byte Prgm }
LBL “CHIT”
STO “FTR”
RSUM
RCL “FTR”
TRANS
RSUM
TRANS
ENTER
RSUM
DET
STO 03
R↓
*
RCL 03
./.
ENTER
ENTER
STO “FTI”
RCL”FTR”
-
X↑2
X<>Y
1/X
DOT
STO 01
RCL “FTR”
DIM?
1
-
X<>Y
1
-
*
STO 03
PGMINT “CHIX”
0
STO “LLIM”
RCL 01
STO “ULIM”
.0001
STO “ACC”
INTEG “X”
STO 02
RCL 03
RCL 01
RCL 02
END

{ 47 - Byte PRGM }
LBL “CHIX”
MVAR “X”
RCL ”X”
RCL 03
2
./.
1
-
Y↑X
RCL “X”
+/-
2
./.
E↑X
*
2
RCL 03
2
./.
Y↑X
./.
RCL 03
2
./.
GAMMA
./.
RTN
END
 « Next Oldest | Next Newest »

 Messages In This Thread (42S) (DM42) CHI²-Test for the statistical independence of two classified variables. - rawi - 02-09-2020 03:10 PM

User(s) browsing this thread: 1 Guest(s)