UNIVERSITY OF CALIFORNIA, LOS ANGELES
Department of Economics

Economics 143 (Cameron) - Applied Regression Analysis

SHAZAM code [larent.sha]




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

sample 1 26
set nowarn
read(larent.dat) rent sqkld bed sqbed bath sqbath pkg beach ucla
* get descriptive statistics and data covariance matrix
stat / pcor
plot beach ucla

* regress rent on everything available
*    do automated F-tests following the ols
ols rent sqkld bed sqbed bath sqbath pkg beach ucla / pcov

test
test bed=0
test bath=0
end

test
test sqkld=0
test sqbed=0
test sqbath=0
end

test beach-ucla=0

confid beach ucla
* or try it with gnuplot:
confid beach ucla / gnu

* regress rent on just the square feet variables
ols rent sqkld sqbed sqbath pkg beach ucla

* regress rent on just the number of rooms of each type
ols rent bed bath pkg beach ucla

* try some of the set of auxiliary regressions to look for sources of
*   multicollinearity
ols sqkld bed sqbed bath sqbath pkg beach ucla
ols bed sqkld sqbed bath sqbath pkg beach ucla
ols beach sqkld bed sqbed bath sqbath pkg ucla 

* create total square feet and total distance, also to be used to test whether
*  the coefficients on each set of variables are identical within the group
genr feet=sqkld+sqbed+sqbath
genr dist=beach+ucla

* regress rent on only the two aggregated variables, without number of rooms
*   of each type
ols rent feet pkg dist

* regress rent on feet and distance, including numbers of rooms
ols rent feet bed bath pkg dist

* regress rent on feet, bed, bath, pkg and separate distance variables
ols rent feet bed bath pkg beach ucla

* automated test of whether coefficients on sqkld,sqbed and sqbath are
*   the same; test of whether coefficients on beach and ucla are the same:
ols rent sqkld sqbed sqbath bed bath pkg beach ucla

* test the two restrictions on square feet variables:
test
test sqkld-sqbed=0
test sqkld-sqbath=0
end

* test the single restriciton on distance:
test beach-ucla=0


*  part (h.)
plot rent ucla
ols rent ucla
ols rent ucla beach
ols rent ucla beach bed
ols rent ucla beach bed pkg

*  part (k.)
skipif(bed.ne.1)
ols rent sqkld sqbed sqbath pkg beach ucla
delete skip$
skipif(bed.ne.2)
ols rent sqkld sqbed sqbath pkg beach ucla
delete skip$
skipif(bed.ne.3)
ols rent sqkld sqbed sqbath pkg beach ucla
ols rent sqkld sqbed sqbath beach ucla

plot rent pkg
ols rent ucla
ols rent beach ucla
ols rent beach ucla bed bath pkg




Updated: 7:58 AM 10/22/98; Prepared by: Trudy Ann Cameron; Site Index