UNIVERSITY OF CALIFORNIA, LOS ANGELES
Department of Economics

Economics 143 (Cameron) - Applied Regression Analysis

SHAZAM code [het1.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 e143sh14.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 (e143sh14.sha) downloaded from UCLA Econ 143 (CAMERON) WebSite" should be the first line of your edited program file. Save the edited program as het1.sha



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

file 6 het1.out
sample 1 52
read(het1.dat) weeks perfect
* now suppress a lot of distracting warnings
set nowarn
set nowarnskip

plot perfect weeks / nopretty

* does performance improve with weeks of experience?
ols perfect weeks
test weeks=0

* given repeated observations at each number of weeks, calculated sample
* estimate of conditional error variances for each number of weeks:

skipif(weeks.ne.1)
stat perfect / var=varp1
delete skip$

skipif(weeks.ne.2)
stat perfect / var=varp2
delete skip$ 

skipif(weeks.ne.3)
stat perfect / var=varp3
delete skip$

skipif(weeks.ne.4)
stat perfect / var=varp4
delete skip$ 

skipif(weeks.ne.5)
stat perfect / var=varp5
delete skip$ 

skipif(weeks.ne.6)
stat perfect / var=varp6
delete skip$ 

skipif(weeks.ne.7)
stat perfect / var=varp7
delete skip$ 

dim varperf 7
sample 1 7
genr wks=time(0)

* why do we need a new variable name for weeks as used here?
genr varperf:1=varp1
genr varperf:2=varp2
genr varperf:3=varp3
genr varperf:4=varp4
genr varperf:5=varp5
genr varperf:6=varp6
genr varperf:7=varp7

plot varperf wks

* now restore the full sample--otherwise only the first six observations
* would be used
sample 1 52

* create regression weights that are exactly equal to 1/(sigma squared) for
* each number of weeks:
if(weeks.eq.1) wsig=1/varp1
if(weeks.eq.2) wsig=1/varp2
if(weeks.eq.3) wsig=1/varp3
if(weeks.eq.4) wsig=1/varp4
if(weeks.eq.5) wsig=1/varp5
if(weeks.eq.6) wsig=1/varp6
if(weeks.eq.7) wsig=1/varp7
stat wsig
* if we use the above weights, what quantity does SHAZAM use to multiply
*  each of the variables (including the intercept) in the transformed 
*  regression?


* acknowledging nonconstant error variances, does performance improve
* with weeks of experience?
ols perfect weeks / weight=wsig
test weeks=0





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

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