# st: degree of freedom and FGLS

 From "Majid Ghorbani" <[email protected]> To <[email protected]> Subject st: degree of freedom and FGLS Date Tue, 9 Oct 2007 16:18:14 -0700

```Dear experts,

I have two question; the first question has 3 scenarios and the second one a
choice between FGLS and FE.

Q1. I�m confused about calculating degree of freedom in panel data. The
following three scenarios are most interesting to me:

The first scenario is under normal circumstance when I am running regression
(e.g. OLS). Let�s say I have trade of 20 countries with 5 states over 15
years period. Assuming that there are no missing data, I will have (20*5
cross-section and 15 time-series) 20*5*15 = 1500 observations. If I have 14
independent variables (iv), should I assume that I have 1500 - (14 +1) =
1485 df?

Scenario 2: In similar situation, if I am running robustness of my
regression using, for example, countries as my cluster, should I assume that
I have 5*15=75 observations, and therefore, 75 - (14+1) = 60 d.f.?

Scenario 3. I want to know the d.f. when I am trying to find out whether my
data is heteroskedastic or not. In such test, according the help file, I
have to do the following:

xtgls dv iv1 iv2 iv3 �, panels(heteroskedastic)
estimates store Hetero
xtgls dv iv iv2 iv3 ...
df = e(N_g) - 1 �
lrtest Hetero .,df(�df�)

Apparently I am supposed to tell STATA the exact number of d.f. to not allow
the software automatically assume the �usual� number of d.f., which, as
mentioned in the first scenario, I am unsure how many it is as well.
According to the manual e(N_g) means number of groups or number of
cross-sections, which, in my case, I am confused whether it is 20 or
20*5=100. However, e(N_g) - 1 = 20 - 1 = 19 does not make any sense (or it
does)? When I was using the above commands, I accidentally forgot to type
the d.f. amount in the brackets ('df'). STATA displayed an error message
telling me that the d.f. is 8. This really confused me, because it made even
less sense.

Q2. If my data proved to be heteroskedastic and autocorrelated, should I run
FGLS or fixed effect (as determined by Hausman test)? By FGLS, I mean using
the command xtgls with "heteroskedastic" and "correlate" options and by
fixed effect I mean using "xtreg" command with fe option.

Majid

*******************************
Majid Ghorbani
PhD Candidate�
Simon Fraser University
500 Granville Street
Tel: 604-732-4533
Mobile/Cell: 778-839-8840
[email protected]

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```