First Differencing (Fixed Effects)

We will use the mm.dta dataset for these exercises. Recall that it is a panel dataset tracking agricultural households in Ethiopia over time. The panel identifier is qnno (household) and the time identifier is tindex (time index).

  • Load mm.dta.
  • Start by running a pooled OLS regression of yield on totfertcostha, clustering the standard errors at the qnno level.
  • Sort the dataset by the panel identifier (qnno) and the time variable (tindex).
  • Generate a first-differenced variable for yield d_yield (e.g., yield - yield[_n-1]) by qnno.
  • Generate a first-differenced variable for fertilizer input d_fert (e.g., totfertcostha - totfertcostha[_n-1]) by qnno.
  • Run a regression of the differenced yield on the differenced fertilizer variable, clustering the standard errors at the qnno level.

1. Use eststo to save the pooled OLS and FD results. Then use esttab to create a table of results using the following table structure:

   esttab      ols fd using "$answ/11-fd.tex", replace ///
                    b(3) se(3) ///
                    rename(totfertcostha "Fertilizer Cost" d_fert "Fertilizer Cost") ///
                    keep("Fertilizer Cost") ///
                    star(* 0.10 ** 0.05 *** 0.01) ///
                    stats(N r2, labels("Observations" "R-squared") fmt(0 3)) ///
                    noobs booktabs nonum nomtitle collabels(none) ///
                    nobaselevels nogaps fragment label ///
                    prehead("\begin{tabular}{l*{2}{c}} " ///
                      "\\[-1.8ex]\hline \hline \\[-1.8ex] " ///
                      "& \multicolumn{1}{c}{OLS} & " ///
                      "\multicolumn{1}{c}{FD} \\ \midrule") ///
                    postfoot("\hline \hline \\[-1.8ex] " ///
                      "\multicolumn{3}{p{\linewidth}}{\small " ///
                      "\noindent \textit{Note}: Dependent variable " ///
                      "is chickpea yield in kg/ha. All models use " ///
                      "standard errors clustered at the " ///
                      "household level (in parentheses). " ///
                      "* p$<$0.10, ** p$<$0.05, *** p$<$0.01.} " ///
                      "\end{tabular}")

2. What is the effect of a change in fertilizer cost on chickpea yield? How does it compare to the pooled OLS estimate?