/* Class 5 Exercise 2014.do */ clear all prog drop _all capture log close set more off global datadir "C:\ENTER DIRECTORY WHERE YOUR DATA ARE STORED" global logdir "C:\ENTER DIRECTORY WHERE YOU WANT TO STORE YOUR LOG FILES" log using "$logdir\class5 solution log 2014.smcl", replace use "$datadir\newschools9810.dta", clear * Question 1. * Regression 1 * Fill in the first command reg * Question 2. * Regression 2 /* Note that the first command generates a dummy (year98) using the year variable, which equals 1 if year = 1998 and 0 if not. */ * Fill in the second command gen year98 = (year==1998) gen year02 = gen year06 = gen year10 = reg * Question 3. * Regression 3 * Note that the first command creates the totreg squared variable. * Fill in the regression command. gen regsq = totreg*totreg reg * Question 4. * Regression 4 /* Note that the first command generates a dummy (boromn) for the borough of Manhattan (1) or not (0) using the boro variable. */ /* To determine which number corresponds to which borough using the boro variable, see Appendix: Variable Names and Definitions. */ /* Fill in the commands for Bronx (borobx), Brooklyn (borobk), Queens (boroqn), and Staten Island (borosi) dummies and for the regression. */ gen boromn = (boro == 1) gen borobx = gen borobk = gen boroqn = gen borosi = reg * Question 4.a. and 4.b. * Significance Tests /* Note that the first command tests the joint significance of totreg and regsq (using the F test). */ * Fill in the second command test totreg regsq test save "$datadir\Class 5 Exercise YOURINITIALS.do", replace log close