I'm using panel data in my study.
So far, already done the analysis with xtreg, for re and fe, and Hausman test yielded that I should use re.
However, when I wanted to test for Heteroscedasticity, I could not find a command specified for re.
Welcome to the site, Joseph. I have not personally used tests for heteroskedasticity in the residual errors, however, you can get a read of whether you have any problems by looking at a couple of plots of your residual values. One common plot is a residual vs. fitted values plot, which you generally like to see having a nebulous cloud pattern. If you switch from xtreg
to mixed
, below I've pasted code to pull the residuals and fitted values from your model and then plot it:
mixed dv iv || clusterID:
predict sresid, rstandard // standardized level 1 residuals
predict predval, xb // predicted outcome value
scatter sresid predval // cloud graph – hopefully no pattern
You can also examine the normality of your residuals using a Q-Q plot, which plots the residuals as a function of a normal distribution, but stretched out along a line. Major deviations of residual points from the normal line are a problem.
*Level 1 residuals vs. normal scores graph
qnorm sresid // residuals should fall along the line
Although not all Stata-specific, there are many good resources for diagnosing any abnormality in your residuals.
robust
option in yourxtreg
model statement. $\endgroup$