Robust Hausman test for FE vs RE

For quite a while I was writing a program to perform a Hausman test to compare Fixed vs Random Effects in Stata when the estimates were calculated using cluster-robust standard errors, since in this case the usual Hausman test is not suitable. Just when I was about to finish with it, I found out that there is already a user-written program that does this and several other tests that fall into the “overidentifying restrictions” class for panel models. The command name is xtoverid and it can be very useful, especially if you are using panel IV methods or Hausman-Taylor models.

xtoverid

Manipulating variable labels

Occasionally we want to use variable labels in loops or we want to apply them to other labels. a very simple local syntax function for that is local localname: variable label varname.

As an example, suppose that I have three variables (x, y, z) with their respective labels. I want to create three other variables with their mean and I want to label those variables using the labels from x, y and z. I can type:

global varlist1 x y x Continue reading

Dialog box in Stata

Sometimes it is useful to have the dialog box for Stata commands, especially for the ones where the syntax is complex, such as the graphic commands. If you know the name of the command (e.g. regress)  but you don’t know how to access the dialog box from the drop down menus, you can always type:

db COMMAND (e.g. db regress)

in the Stata command interface. This will bring up the dialog box. It is a very useful shortcut, although it sometimes fosters “irresponsibility”, since it makes it extremely easy to apply methods you do not fully understand.