# Account for both between and within variance in panel data

I have a general question on fixed-effects and mixed-effects models for panel data. I am doing a logistic regression on panel data, with data measured on the individual level.

I understand that by using fixed-effects in my model (xtlogit...,fe in Stata) I basically ignore or do not look at the difference between individuals, but rather use the within variance of the IVs to calculate the coefficients.

Question: But what if there's also considerable difference between the individuals that I would like to capture? Is it even possible to account for both the unobserved heterogeneity (through fixed-effects) and the variance between individuals?

I read a lot about Random Effects, Population-averaged models, between-estimator and mixed-effects but I can't bridge my intellectual gap on the question "when to use which model?".

I feel that the mixed-effects logistic regression (xtmelogit in Stata) might apply, but the term random intercept got me thinking if that really captures the variance between individuals in panel data. Also my data is not nested as in most of the examples on mixed-effects models which speak of clusters or group levels (e.g. students in schools).

## 2 Answers

You can account for certain unobserved heterogeneity in panel, called correlated random effects, if you are willing to make certain assumptions about the correlation of the unobserved heterogeneity with the observed regressors.

Let us say $y_{it}$ is your outcome of interest (perhaps a binary variable), $X_{it}$ are observable individual characteristics, $\gamma_{i}$ is a time-invariant unobserved individual effect and $u_{it}$ are independent errors (possibly correlated over time) and you are interested in (I do not use here any non-identical link function for a possible binary outcome for simplicity reasons)

$y_{it} = \beta_0 + \beta_1 X_{it} + \gamma_i + u_{it}$

Keep it mind that fixed effects allows for an arbitrary correlation between unobserved time-invariant indidivual heterogeneity and other characteristics $Cov(\gamma_i,X_{it})$ while in the random-effects world there must not be any correlation $Cov(\gamma_i,X_{it})=0$. If you know that the unobserved heterogeneity in your panel data depends on observed characteristics in a certain way you can model it. A famous example is by using the individual mean of the observed variables over time, see Mundlak (1978):

$\gamma_i = \alpha_0 + \alpha_1 \bar{X}_i + \epsilon_i$

But it is very crucial that your assumptions about the specific dependency hold. A more general has been introduced by Chamberlain (1982).

Imbens and Wooldridge talk about these methods in their lecture series:

http://www.nber.org/WNE/lect_2_linpanel.pdf

And here is another source discussing these topics:

http://www.u.arizona.edu/~hirano/696_2010/ln10.pdf

Building upon Arne's answer, there's a very interesting paper by Bell/Jones (2012), mentioned in this post Panel regression: what to do when Hausman test fails and want to keep time invariant regressors?.

They argue in favor of an RE model to capture both within and between variance by 'Within-Between transformation', essentially building upon Mundlak (1978).

I found this passage particularly interesting and I'm wondering whether your hint that

.. it is very crucial that your assumptions about the specific dependency hold

still holds true in light of that paper?

In the paper, it's said: Where the within and between effects are different, β1 in equation 1 will be an uninterpretable weighted average of the two processes (Krishnakumar, 2006, Neuhaus and Kalbfleisch, 1998, Raudenbush and Bryk, 2002 p137) whilst variance estimates are also affected (Grilli and Rampichini, 2011). This can be thought of as omitted variable bias (Bafumi and Gelman, 2006, Palta and Seplaki, 2003); because the between effect is omitted, β1 attempts to account for both the within and the between effect of the covariate on the response, and if the two effects are different, it will fail to account fully for either. The variance that is left unaccounted for will be absorbed into the error terms and , which will consequently both be correlated with the covariate, violating the assumptions of the RE model.

Leading to the model which can be rearranged to Crucially, there can be no correlation between the group mean centred covariate and the higher-level variance because the group mean centred covariate has a mean of 0 for each higher-level entity j.

Bell, Andrew; Jones,Kelvyn (2012): Explaining Fixed Effects: Random Effects modelling of Time-Series Cross-Sectional and Panel Data, Working Paper

I found this paper very helpful. The link is http://polmeth.wustl.edu/media/Paper/FixedversusRandom_1_2.pdf