Demeaning the Data (Fixed Effects)
Using mm.dta:
- Use
egenwithbysort qnno:to calculate the household-specific mean foryield. - Do the same to calculate the household-specific mean for fertilizer cost
totfertcostha. - Generate demeaned versions of both variables by subtracting the household mean from the original value (e.g.,
dm_yieldanddm_fert). - Run a regression of the demeaned yield on the demeaned fertilizer, clustering standard errors by
qnno.
- Use
eststoto save the demeaned results. Then adapt the table structure from the previous exercise to create a table of results with a third column headedDemean. - What is the coefficient on fertilizer cost in the demeaned regression and how does it compare to the coefficients you calculated in Exercises 1?