/*This is the dofile for use with the CPS5 file from Goldberger's (1998)
undergraduate econometrics textbook.
This file estimates LS lines for different data transformations for
Meredith Crowley's Lecture 7 in Part I Paper 3 for Lent 2016. It also reports
R^2 (a measure of model fit) and r^2 (the square of the correlation coefficient
between Y and X). Students can verify that these are equivalent for the
specifications below. */
clear matrix
clear
set more off
cd "C:\Users\mc865\Dropbox\Teaching2015-2016\Stats\Stata\"
/* This is the directory used. This is the only line that refers to an
absolute path. Alternatively C:\mypath can be used by using the following command: */
/* cd "C:\mypath" */
/*The dataset is Goldberger's May 1985 extract of the CPS with 528 observations.
Make sure this datafile with stata extension .dta is in the folder listed above.*/
use cps5, replace
/*For lecture 5*/
/*Estimate y on x */
/*Estimate ln y on x */
/*Estimate ln y on ln x*/
gen ln_wage=ln(wage)
gen ln_educat= ln(educat)
/*Estimate y on x */
reg wage educat
corr(wage educat)
/*Estimate ln y on x */
corr(ln_wage educat)
reg ln_wage educat
/*Estimate ln y on ln x*/
corr(ln_wage ln_educat)
reg ln_wage ln_educat