Tests for Multicollinearity
/****************************************************************/
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: MULTICOL */
/* TITLE: Tests for Multicollinearity */
/* PRODUCT: IML */
/* SYSTEM: ALL */
/* KEYS: ECON */
/* PROCS: CORR IML */
/* DATA: */
/* */
/* SUPPORT: LWB UPDATE: */
/* REF: */
/* MISC: TRANSLATED FROM MATRIX TO IML USING MATIML */
/* */
/****************************************************************/
DATA ONE; INPUT X1-X4; CARDS;
1 2 3 4
4 3 2 1
5 6 7 8
4 5 6 7
1 2 3 5
1 2 3 3
2 3 4 3
6 4 5 3
0 0 0 0
0 1 0 1
0 1 2 0
1 2 0 0
2 3 4 5
7 8 9 0
1 5 3 4
1 4 5 7
9 4 5 7
5 4 1 2
3 5 3 5
1 3 2 3
7 6 9 8
2 3 5 6
;
RUN;
PROC CORR DATA=ONE OUTP=C;
VAR X1-X4;
RUN;
PROC IML;
RESET AUTONAME ;
PRINT " TESTS FOR MULTICOLLINEARITY BY FARRAR AND GLAUBER";
*------ REF: FARRAR AND GLAUBER, "MULTICOLLINEARITY..."
REVIEW OF EC AND STAT, FEB 1967 V 49;
*-----ALSO IN KOUTSOYIANNIS, THEORY OF ECONOMETRICS;
USE C (FIRSTOBS=3);
READ ALL INTO R [COLNAME=VARS];
K= NCOL(R);
N= R[1,1];
R= R[2:K+1,];
DET= DET(R);
RINV= INV(R);
PRINT " -----TEST 1---TEST OVERALL MULTICOLLINEARITY----";
CHISQ=-(N-1-(2#K+5)/6)# LOG(DET);
SIGPROB=1- PROBCHI(CHISQ,.5#K#(K-1));
PRINT CHISQ, SIGPROB;
PRINT " -----TEST 2---TEST EACH VARIABLE-----";
F=( VECDIAG(RINV)-1)#(N-K)/(K-1);
SIGPROB=1- PROBF(F,K-1,N-K);
PRINT F, SIGPROB[ ROWNAME=VARS];
PRINT " -----TEST 3---TEST EACH PAIR OF VARIABLES-----";
D = DIAG( 1/SQRT(VECDIAG(RINV)) );
PCOR=D*R*D;
D= SQRT(1-PCOR#PCOR);
DIAGIDX = DO(1, NROW(D)*NCOL(D), NCOL(D)+1);
D[DIAGIDX] = .; /*REPLACE DIAGONAL WITH MISSING*/
TTEST=PCOR# SQRT(N-K)/D;
TTEST= CHOOSE(TTEST=.,TTEST^=.,TTEST);/*REPLACE MISSING WITH ZERO*/
SIGPROB=2 -2* PROBT(TTEST,N-K);
PRINT TTEST, SIGPROB[ ROWNAME=VARS COLNAME=VARS];