UNIVERSITY OF CALIFORNIA, LOS ANGELES
Department of Economics

Economics 143 (Cameron) - Applied Regression Analysis

SHAZAM code [multicol.sha]


If you are downloading this SHAZAM code for use on your own computer, select "File", then "Save As...", and save on your own diskette (a:) or your own hard drive (c:\) using the same filename e143sh12.sha.

IMPORTANT: you must then use an editor (like TED) to delete all of the HTML code from the top and the bottom of the file, leaving only the SHAZAM code. The line which reads "* SHAZAM code (e143sh12.sha) downloaded from UCLA Econ 143 (CAMERON) WebSite" should be the first line of your edited program file. Save the edited program as multicol.sha



* SHAZAM code downloaded from UCLA Econ 143 (CAMERON) WebSite: 
* HTML file called e143sh12.htm, and should have 
*  been downloaded as multicol.sha

*-------------------------------------------------------------
* EXAMPLE OF "HIGHER-ORDER" MULTICOLLINEARITY.  PAIRWISE CORRELATIONS AMONG
* REGRESSORS AND/OR PLOTS OF PAIRS OF REGRESSORS DO NOT REVEAL ANY SERIOUS
* CORRELATIONS.  NO PAIR OF VARIABLES PRESENTS A PROBLEM BUT ALL THREE
* TOGETHER SPELL TROUBLE FOR THE RESULTING ESTIMATES

file 6 multicol.out
sample 1 20
*read(n:multicol.dat) y x1 x2 x3
read(multicol.dat) y x1 x2 x3
print y x1 x2 x3

* examine pairwise correlations (not always enough to detect higher-order
* multicollinearity)
stat y x1 x2 x3 / pcor

* like stat, plots can sometimes reveal multicollinearity among regressors,
* but not all the time.  check pairwise relationships among regressors here:
plot x1 x2
plot x1 x3
plot x2 x3

* check simple regressions of y on each of x1 x2 x3:
ols y x1
ols y x2
ols y x3

* do successive regressions on additional explanatory variables;
* adding a collinear regressor can destroy the statistical significance of
* variables that were added earlier
ols y x1
ols y x1 x2
ols y x1 x2 x3

* do the "auxiliary regressions" yourself; look for regressors that are
* almost perfect linear functions of other regressors (check r-squared values)
ols x1 x2 x3
ols x2 x1 x3
ols x3 x1 x2

* or, have shazam do the auxiliary regressions for you
ols y x1 x2 x3 / auxrsqr

* even though you cannot reject the zero hypothesis for individual 
* coefficients, try an f-test for the overall significance of the regression
test
test x1=0
test x2=0
test x3=0
end

* check the confidence ellipses to see what is going on:
*confid x1 x2 / gnu lineonly
*confid x2 x3 / gnu lineonly
*confid x1 x3 / gnu lineonly
confid x1 x2
confid x2 x3
confid x1 x3
 




COURSE OUTLINE LECTURE OUTLINES PROBLEM SETS PROBLEM SOLUTIONS
COMPUTER LABS SHAZAM EXAMPLES DATA SETS ONLINE QUIZZES

Updated: November 11, 1997
Prepared by: Trudy Ann Cameron