I want to compare several models. In these, I sometimes control for effects from groups of a discrete variable, as "foreign" ("fid") in the example below.
In my case, the number of values this variable takes are too high to report all the coefficients, and the coefficients would be meaningless for interpretation anyway. Therefore, I use the -indicate- option to just show whether I controlled for this variable or not (see below).
In the four models below, I first control for foreign make (m1), then I don't (m2), and then I repeat these two regressions, but accounting for heteroskedasticity, indicated by the option
Controlling or not for -foreign- make can be indicated easily by the "foreign effect" line that you can see I manually added there.
I would like to add a similar line for the robust option, so that it is indicated automatically if (and what) robust model was used.
The reason is, in the below code, if I did not specify the option "mtitles", all models would have the same title (namely, "price", as it is the dependent variable) in the file. Therefore, I am forced to manually adapt the model titles ("estimates store mXrobust") to include the term "robust" or similar, which is inelegant and also errorprone: I might accidentally forget to update the model titles, just have models m1, m2, m3, m4 with seemingly identical specifications, yet different standard errors. So I want Stata to automatically display the use of the "robust" option for each model, preferably in a way similar to the indicate "Yes"/"No" option for "fid".
How can this be achieved?
Array
In my case, the number of values this variable takes are too high to report all the coefficients, and the coefficients would be meaningless for interpretation anyway. Therefore, I use the -indicate- option to just show whether I controlled for this variable or not (see below).
In the four models below, I first control for foreign make (m1), then I don't (m2), and then I repeat these two regressions, but accounting for heteroskedasticity, indicated by the option
Code:
, vce(robust)
I would like to add a similar line for the robust option, so that it is indicated automatically if (and what) robust model was used.
The reason is, in the below code, if I did not specify the option "mtitles", all models would have the same title (namely, "price", as it is the dependent variable) in the file. Therefore, I am forced to manually adapt the model titles ("estimates store mXrobust") to include the term "robust" or similar, which is inelegant and also errorprone: I might accidentally forget to update the model titles, just have models m1, m2, m3, m4 with seemingly identical specifications, yet different standard errors. So I want Stata to automatically display the use of the "robust" option for each model, preferably in a way similar to the indicate "Yes"/"No" option for "fid".
How can this be achieved?
Code:
clear sysuse auto egen fid = group (foreign) xi: reg price mpg headroom trunk i.fid estimates store m1 xi: reg price mpg headroom trunk estimates store m2 xi: reg price mpg headroom trunk i.fid , vce(robust) estimates store m3robust xi: reg price mpg headroom trunk , vce(robust) estimates store m4robust esttab * using mwe27.tex, mtitles /// replace indicate("foreign effect = _Ifid_*")