# Difference between panel data & mixed model

I would like to know the difference between panel data analysis & mixed model analysis. To my knowledge, both panel data & mixed models use fixed & random effects. If so, why do they have different names? Or are they synonymous?

I've read the following post, which describes the definition of fixed, random & mixed effect, but doesn't exactly answer my question: What is the difference between fixed effect, random effect and mixed effect models?

I would also be grateful if somebody could refer me to a brief (about 200 page) reference on mixed model analysis. Just to add, I would prefer mixed modeling reference irrespective of software treatment. Mainly theoretical explanation of mixed modelling.

Both panel data and mixed effect model data deal with double indexed random variables $y_{ij}$. First index is for group, the second is for individuals within the group. For the panel data the second index is usually time, and it is assumed that we observe individuals over time. When time is second index for mixed effect model the models are called longitudinal models. The mixed effect model is best understood in terms of 2 level regressions. (For ease of exposition assume only one explanatory variable)

First level regression is the following

$$y_{ij}=\alpha_i+x_{ij}\beta_i+\varepsilon_{ij}.$$

This is simply explained as individual regression for each group. The second level regression tries to explain variation in regression coefficients:

$$\alpha_i=\gamma_0+z_{i1}\gamma_1+u_i$$ $$\beta_i=\delta_0+z_{i2}\delta_1+v_i$$

When you substitute the second equation to the first one you get

$$y_{ij}=\gamma_0+z_{i1}\gamma_1+x_{ij}\delta_0+x_{ij}z_{i2}\delta_1+u_i+x_{ij}v_i+\varepsilon_{ij}$$

The fixed effects are what is fixed, this means $\gamma_0,\gamma_1,\delta_0,\delta_1$. The random effects are $u_i$ and $v_i$.

Now for panel data the terminology changes, but you still can find common points. The panel data random effects models is the same as mixed effects model with

$$\alpha_i=\gamma_0+u_i$$ $$\beta_i=\delta_0$$

with model becomming

$$y_{it}=\gamma_0+x_{it}\delta_0+u_i+\varepsilon_{it},$$

where $u_i$ are random effects.

The most important difference between mixed effects model and panel data models is the treatment of regressors $x_{ij}$. For mixed effects models they are non-random variables, whereas for panel data models it is always assumed that they are random. This becomes important when stating what is fixed effects model for panel data.

For mixed effect model it is assumed that random effects $u_i$ and $v_i$ are independent of $\varepsilon_{ij}$ and also from $x_{ij}$ and $z_i$, which is always true when $x_{ij}$ and $z_i$ are fixed. If we allow for stochastic $x_{ij}$ this becomes important. So the random effects model for panel data assumes that $x_{it}$ is not correlated with $u_i$. But the fixed effect model which has the same form

$$y_{it}=\gamma_0+x_{it}\delta_0+u_i+\varepsilon_{it},$$

allows correlation of $x_{it}$ and $u_i$. The emphasis then is solely for consistently estimating $\delta_0$. This is done by subtracting the individual means:

$$y_{it}-\bar{y}_{i.}=(x_{it}-\bar{x}_{i.})\delta_0+\varepsilon_{it}-\bar{\varepsilon}_{i.},$$

and using simple OLS on resulting regression problem. Algebraically this coincides with least square dummy variable regression problem, where we assume that $u_i$ are fixed parameters. Hence the name fixed effects model.

There is a lot of history behind fixed effects and random effects terminology in panel data econometrics, which I omitted. In my personal opinion these models are best explained in Wooldridge's "Econometric analysis of cross section and panel data". As far as I know there is no such history in mixed effects model, but on the other hand I come from econometrics background, so I might be mistaken.

• When you substituted (2) and (3) into (1), I think something got mangled. I believe it should be $...+x_{ij}v_{i}+u_{i}+\varepsilon_{ij}$ unless I am missing something. – Dimitriy V. Masterov Aug 20 '12 at 20:23
• This explanation is wonderful! Thanks a lot for taking all the effort for giving me such a wonderful exposition.Just want to ask one thing. What you you mean by 2 level regression? – Beta Aug 21 '12 at 4:52
• @DimitriyV.Masterov, thanks, I fixed the mistake. – mpiktas Aug 21 '12 at 6:03
• @Ari, the second level regression is a regression for regression coefficients of first level regression. The first level regression tries to explain variation within group, whereas the second level regression tries to explain variation across groups. This division is artificial, but I like it since it feels natural for me at least. This type of division is also used in hierarchical Bayes models. – mpiktas Aug 21 '12 at 6:07
• This is a very good answer, +1 long time ago. The only thing that I find missing here is some discussion of how the $\delta_0$ coefficient of the "random effect model" in econometrics is estimated. You explain it for the "fixed effect model", but don't comment on the random one. I would very much appreciate if you could add something about it. – amoeba Oct 3 '16 at 0:40

I too have wondered about the difference between both as well and having recently found a reference on this topic I understand that "panel data" is a traditional name for datasets that represent a "cross-section or group of people who are surveyed periodically over a given time span". So the "panel" is a group-structure within the dataset, and having such a group the most natural way of analyzing this type of data is via a mixed-modelling approach.

A good reference (regardless if you "speak" R or not) on mixed-effects modelling is the draft of a (?)forthcoming book by Douglas Bates (lme4: Mixed-effects modeling with R).

• Thanks ils for the reference! But the problem still remains. – Beta Aug 20 '12 at 12:41

I understand you're looking for a text that describes mixed modelling theory without reference to a software package.

I would recommend Multilevel Analysis, An introduction to basic and advanced multilevel modelling by Tom Snijders and Roel Bosker, about 250pp. It has a chapter on software at the end (which is somewhat outdated now) but the remainder is very approachable theory.

I must say though that I agree with the recommendation above for Multilevel and Longitudinal Models Using Stata by Sophia Rabe-Hesketh and Anders Skrondal. The book is very theoretical and the software component is really just a nice addition to a substantial text. I don't normally use Stata and have the text sitting on my desk and find it extremely well written. It is however much longer than 200pp.

The following texts are all written by current experts in the field and would be useful for anyone wanting more information about these techniques (although they don't specifically fit your request): [I can't link to these because I'm a new user, sorry]

Hoox, Joop (2010). Multilevel Analysis, Techniques and Applications.

Gelman, A., and Hill, J. (2006) Data Analysis Using Regression and Multilevel/Hierarchical Models.

Singer, J. (2003) Applied Longitudinal Data Analysis: Modeling Change and Event Occurance

Raudenbush, S. W., and Bryk, A., S. (2002). Hierarchical Linear Models: Applications and data analysis methods

Luke, Douglas,(2004). Multilevel Modeling

I would also second Wooldridge's text mentioned above, as well as the R text, and the Bristol University Centre for Multilevel Modelling has a bunch of tutorials and information

• Thanks Playitagain! This one is very useful information. Even ur name is interesting :) – Beta Sep 27 '12 at 9:22

If you use Stata, Multilevel and Longitudinal Models Using Stata by Sophia Rabe-Hesketh and Anders Skrondal would be a good choice. Depending on what exactly you are interested in, 200 pages might be about right.

• Thanks Dimitriy for the reference. But unfortunately I don't use STATA. I mainly use SAS, & sometimes R. But thanks anyway. – Beta Aug 20 '12 at 17:26
• I have heard good things about wiley.com/WileyCDA/WileyTitle/productCd-0470073713.html, but I have not read it myself. – Dimitriy V. Masterov Aug 20 '12 at 18:02
• Thanks Dimitriy! This looks really promising. The advantage of asking question rather than goggling is that you get really good results :) – Beta Aug 20 '12 at 18:36

In my experience, the rationale for using 'panel econometrics' is that the panel 'fixed effects' estimators can be used to control for various forms of omitted variable bias.

However, it is possible to perform this type of estimation within a multilevel model using a Mundlak type approach, i.e. including the group means as extra regressors. This approach removes the correlation between the error term and potential group level omitted factors, revealing the 'within' coefficient. However, for a reason unknown to me this is not typically done in applied research. These slides and this document provide an elaboration.

• (+1) Sociologist's often interpret the groups means as contextual effects (although this is more often for nested cross-sectional data than it is for time series panel data). I will need to read up, of related note Manski (1993) (PDF here) has an article that shows how such contextual effects are frequently not identified. For "reasons this is not done" I suspect it is as much difference between social science practice as anything, it might be a good question to ask. – Andy W Aug 21 '12 at 12:35

@mpiktas has given a thorough answer. I would also suggest reading the Chapter 7 of documentation for plm package in R . The authors' discussion about difference between mixed models and panel data is worth a read.