# Need to model Panel Data

I have been given a assignment in which I fit various panel data models on a given set of data, and explain the pros and cons of each model.

My data has 3 dependent variables, 6 independent variables and 10 dummy variables (cities) and is unbalanced (what effect does this have?)

After reading books and watching videos, I think I need to...

1) Fit 3 pooled OLS models (once with each of the three dependent variables), repeating with the inclusion of dummy variables. I'm expecting to find that pooled ols ignores the effects of specific cities and gives me a incorrect results (endogenity?). The Dummy pooled ols incorporates city specific effects, but.......?

2) From here my knowledge goes a bit hazy. I know the next three models are first differences & fixed and random effects, I know briefly what they are however the fact I've read 10 books, watched 3-4 youtube videos and read the lecture slides and workshop instructions means I don't yet have a single solution of what to do. Basically, I've read explanations from too many different sources, and the incoherence has confused me.

• When you say: "I dont what to do?". Do you mean which model(s) to estimate?, or how to code the estimators?, or both? Which software are you using? – Repmat May 2 '15 at 14:33
• I'm unaware of the logical steps to follow in estimating the models. I.e once i've ran pooled ols models, what is the next step? And the step after that? I'm pretty sure I can find the codes I need through STATA books etc – Terrence May 2 '15 at 15:20

Well the problem with pooled OLS (POLS), is then when you have the same people across time there is bound to be serial correlation - POLS does not account for this and is there (usually) not efficent. Really the only advantage you gain from POLS, is just more observations.

Random effects is basically a way to correct for the serial correlation, think of it as panel version of FGLS. To formalize consider the model:

$$y_{it} = \beta_0 + \beta_1 x_{it} + ... + \beta_k x_{it} + a_i + u_{it}$$

Here I have spilt the usual error term, into $a_i$ which are time constant factors and $u_{it}$ which you can think of as just the usual error term. The entire benefit of panel data is that you can actually do something about time constant omitted variables. With either fixed effects FE (within) or first difference FD (which is also a version of fixed effects), the goal is to eliminate the $a_i$, but if you do not think there are time constant omitted variables, then you should not eliminate the $a_i$ - you should model the serial correlation (random effects RE).

If you think that there are actually time constant omitted variables (say ability, IQ etc.), then you should do something about that. With FD you simply first difference the equation (subtract period 1 from period 2), and apply OLS to that. With FE you compute the time mean (a mean for each unit) and subtract form each observation then apply OLS. Either way it removes the $a_i$ from the equation, it does nothing for omitted variables that are not constant over time - so you might still have a problem with $u_{it}$, but the usual analysis applies.

To sum up; Use RE when you do not you have any omitted time constant variables. Otherwise use FE or FD. If there are only two time periods then FE = FD. For larger T thing are not that easy. If there is a not a lot of serial correlation in the errors term, then FE is usually most efficient. But if the serial correlation is close to 1 (numerically) then FD will remove most of that and FE should be you your choice.

Usually one would estimate the model by RE, FE, FD and POLS and see how they compare. For instance I would be nice if the al gave roughly the same estimate (which does not happen often). But perhaps they all give the same sign (which is nice). In all cases the usual OLS standard is not valid, but there exists standard errors which are robust (so called cluster errors).

For implementation; I do not know a lot about Stata but xtreg seems to be what you are after. From the guide I googled, it seems straight forward. I think Stata also have a neat GUI, maybe try that?

Otherwise just follow your intuition, try estimating a bunch of models, do some test and see what happens.

• Thanks for this great answer! After speaking to my peers and reading for a couple of days, in terms of application I think it makes sense to start with the Hausman Test, to see if I need to use FE or RE, after I perform Pooled OLS and show it is not the best? I think I will definitely estimate RE, FE, FD & POLS either way, and show results/analyse. – Terrence May 5 '15 at 10:55
• Sure, but remember that the Hausmann test requires the full set of assumptions (classical linear model assumptions) - often they are very restrictive. Best of luck. – Repmat May 5 '15 at 13:23
• Hi! I've made some progress. After reading what you've written/loads of books the 'penny dropped' and it all makes sense. I have a question, what are the determining factors of which model is the best? The hausman and f-test confirms FE over RE and POLS respectively. Is it just the usual analysis that applies? (r2, standard error etc, parsimony). Also, I'm detecting a dynamic relationship which I believe I need to fix with GMM, however I plan to ask a fresh question for that. – Terrence May 12 '15 at 6:54
• FE should be preferred in the case where you think, that the levels model contains time constant factors. If they do -> use FE/FD, if not model the serial correlation with RE. But generally FE is preferred (at least in economics, since we dont want effects to be random). But other than this, subtle point, you are correct... – Repmat May 12 '15 at 13:36

Maybe the following link will help. Its very comprehensive and covers Fixed & Random effects models, with clear step by step instructions using STATA.

http://www.princeton.edu/~otorres/Panel101.pdf

• This is great. I'm going it leave this post as 'unanswered' incase anyone is able to explain the theory a bit more. – Terrence May 2 '15 at 15:21

After doing some more searching, I've found an excellent comprehensive guide from Hun Myoung Park, which covers alot of theory and then repeats it demonstrating its use in STATA. I hope this helps someone.