Thank you, Andrew , for one more time!
Sorry if I am insisting too much, but I am not getting the last part
So, given that in my case
I wrote the code as follows in order to get 1-a .
It does work for the entire sample, but again It fails when I add the if option, in the regression .I get no observation. What did I do wrong?
It is similar to what I had referred in #14
Sorry if I am insisting too much, but I am not getting the last part
So, given that in my case
nlcom -_b[indicator]/(2*_b[indicator#indicator])
foreach var of varlist decade?{
xtset id ts
xtregar D.gdp cpi u dummy1 dummy2 c.indicator##c.indicator if `var', fe
// get the x where the minimum occurs
local x = -_b[indicator]/(2*_b[indicator1#indicator])
// get the y for that minimim
qui margins, at(indicator = `x' cpi=0 u=2 dummy1=0 dummy2=0 indicator=-4)
// the predictions are stored in the matrix r(b)
// el(r(b),1,1) extracts the cell 1,1 from the matrix r(b)
local y = el(r(b),1,1)
gen indmax2_`var'= `x'
gen gdpmax2_`var'=`y'
gen a_`var' = -_b[indicator]/(2*_b[indicator#indicator])
gen dep_`var' = 1-a
// prepare for our plot
nlcom -_b[indicator]/(2*_b[indicator#indicator])
qui margins, at(indicator=(-16(4)29) cpi=0 u=2 dummy1=0 dummy2=0 indicator=-4)
// with scatteri we can add a point and a label to our graph
marginsplot, noci plotopts(msymbol(i)) legend(off) ///
addplot(scatteri `y' `x' (12) "(`xlab'; `ylab')") ///
ylab(,format(%9.3fc) angle(0)) ytitle("predicted gdp ") title("Predicted Marings pair")
}
xtset id ts
xtregar D.gdp cpi u dummy1 dummy2 c.indicator##c.indicator if `var', fe
// get the x where the minimum occurs
local x = -_b[indicator]/(2*_b[indicator1#indicator])
// get the y for that minimim
qui margins, at(indicator = `x' cpi=0 u=2 dummy1=0 dummy2=0 indicator=-4)
// the predictions are stored in the matrix r(b)
// el(r(b),1,1) extracts the cell 1,1 from the matrix r(b)
local y = el(r(b),1,1)
gen indmax2_`var'= `x'
gen gdpmax2_`var'=`y'
gen a_`var' = -_b[indicator]/(2*_b[indicator#indicator])
gen dep_`var' = 1-a
// prepare for our plot
nlcom -_b[indicator]/(2*_b[indicator#indicator])
qui margins, at(indicator=(-16(4)29) cpi=0 u=2 dummy1=0 dummy2=0 indicator=-4)
// with scatteri we can add a point and a label to our graph
marginsplot, noci plotopts(msymbol(i)) legend(off) ///
addplot(scatteri `y' `x' (12) "(`xlab'; `ylab')") ///
ylab(,format(%9.3fc) angle(0)) ytitle("predicted gdp ") title("Predicted Marings pair")
}
It is similar to what I had referred in #14
Comment