For this I need a loop to repeat the regression for the four crops and also to include the price specific to the crop which is the dependent variable
Following several posts on statalist I was able to run the following loop
Code:
local m=1 foreach Yield in Crop1 Crop2 Crop3 Crop4 { foreach Price in Price1 Price2 Price3 Price4 { local Control Control1 Control2 Control3 eststo model_`m': xtabond2 `Yield' L(1/2).`Yield' L.`Price' `Control' i.Year, gmm(L.Yield `Price', eq(diff)laglimits(2 6)collapse) /// gmm(L.Yield L.Price, eq(level)laglimits(1 4)) iv(L.Year, equation(level)) twostep small robust local m `++m' } } esttab model_* , se(4) b(4) r(2)wide
Evidently something needs to be adjusted in my loop specifying the price variables. Any suggestions?
0 Response to Define nested loops for dependent and independent variables
Post a Comment