0

In Stata I'm trying to plot the coefficients of rdrobust estimates using coefplot:

foreach depvar of varlist var1 var2 var3 var4 {
    rdrobust `depvar' running_variable, kernel(triangular) bwselect(cerrd) p(1)
    estimates store  `depvar'
}

coefplot _est_var1 _est_var2 _est_var3 _est_var4 , replace xline(0)

But I get the following error message:

estimation result _est_var1 not found

Anyone knows how to solve this?

Nick Cox
  • 35,529
  • 6
  • 31
  • 47
mmramame
  • 55
  • 9
  • Cross-posted at https://www.statalist.org/forums/forum/general-stata-discussion/general/1565051-coefplot-for-balance-tests-using-rdrobust Telling people about cross-posting is always a good idea. – Nick Cox Jul 24 '20 at 09:38

1 Answers1

0

I have only changed the last line of your code and I wonder if it would work. As I do not have your data, I have not tested.

foreach depvar of varlist var1 var2 var3 var4{
  rdrobust `depvar' running_variable, kernel(triangular) bwselect(cerrd) p(1)
  estimates store  `depvar'
}
coefplot var1 var2 var3 var4, replace xline(0)
Zhiqiang Wang
  • 6,206
  • 2
  • 13
  • 27
  • Thanks, but did not solve. The estimation is saving results as i named above. – mmramame Jul 24 '20 at 06:13
  • 3
    It would be helpful for others to work out a solution if you could provide a reproducible sample. – Zhiqiang Wang Jul 24 '20 at 06:15
  • 2
    @arabelo where exactly does the estimation save the results with the names you provide? `depvar` in your code expands to `var1`, `var2` and so on. Not `_est_var1`, `_est_var2` etc. –  Jul 24 '20 at 09:06
  • 1
    @arabelo There is a difference between estimation results stored by estimates store and the `_est_*` variable which only stores the sample used for your regression. Have a look at it, the variable only contains 0 and 1 to indicate which observations were used. – Wouter Jul 24 '20 at 09:13