UNIVERSITY OF CALIFORNIA, LOS ANGELES
Department of Economics

Economics 143 (Cameron) - Applied Regression Analysis

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



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

file 6 coffee.out
sample 1 21
read(coffee.dat) atc q

* descriptive statistics, save means
stat atc q / pcor mean=m
plot atc q

* simple regression, save coefficietns
ols atc q / coef=bl

* point estimate of fitted atc at q= mean in sample
gen1 qmfit=bl:1*m:2 + bl:2
print qmfit

* point estimate of fitted atc at q=80
gen1 qfit80=bl:1*80 + bl:2
print qfit80

* redo the regression, test whether expected atc at q=80 is equal to 70
ols atc q / coef=b1
test q*80+constant=70

* use joint confidence ellipse to determine plausible values for parameters
confid q constant

* if this didn't work, try regression through the origin version
genr one=1
ols atc q one / noconstant
confid q one




* prepare for quadratic specification
genr q2=q*q
ols atc q q2 / coef=bq

* prepare for cubic specification
genr q3=q*q*q
ols atc q q2 q3 / coef=bc auxrsqr
stat q q2 q3 / pcor
stop





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

Updated: October 29, 1997
Prepared by: Trudy Ann Cameron