# Correlation matrices with panel data

When reading through https://www.math.lsu.edu/~smolinsk/Quant_Interview_Prep.pdf, I saw the question "Discuss correlation matrices with panel data"

How would you do a correlation matrix with panel data and why/how is this different to whatever the "normal" situation would be?

Consider the case of a simple linear regression using panel data. So, for example, assume we are trying to figure out how age and education affect individuals' income. Also, forget the whole log-linear regression part. To keep this simple, I'm just going to use a simple linear regression. In essence, I want to find the coefficients for the following equation:

$$income = \beta_0 + \beta_{educ}\cdot educ + \beta_{age}\cdot age +\epsilon$$

where $$\epsilon$$ follows some random distribution (typically, normal, centered around zero).

For this example, assume we have surveyed the same set of individuals multiple times over the course of a few years.

Panel data is typically modeled assuming that there is an individual-specific term that dictates the individual-level panel effect. So the equation that describes your model would be something like:

$$income_{n,t} = \beta_0 + \beta_{educ}\cdot educ_{n,t} + \beta_{age}\cdot age_{n,t} + c_n + \epsilon_{n,t}$$

where $$n$$ is the index for each individual ($$n=1,...,N$$), $$t$$ is the index for each surveying period ($$t=1,...,T$$), and $$\epsilon_{n,t}$$ is assumed to be i.i.d. across individuals and time (i.e., independently distributed across all dimensions). Furthermore, $$c_n$$ is typically assumed to be either fixed or normally distributed across individuals according to some distribution. Regardless of it being fixed or random, notice how $$c_n$$ is constant within each individual over time. This is supposed to capture everything that is "special" about that individual and that sets them apart from their peers (note: you can also add a $$d_t$$ term to represent year-specific effects, but I'm omitting that just to keep things simple). But as I mentioned before, the $$c_n$$ term is time-invariant (i.e., it remains constant over the multiple $$t$$ survey periods). Therefore, this approach makes it impossible to teem out the effect of other time-invariant characteristics, such as race and gender.

That's where the correlation matrix comes in. Modeling panel data using a correlation matrix relies on assuming the following equation:

$$income_{n,t} = \beta_0 + \beta_{educ}\cdot educ_{n,t} + \beta_{age}\cdot age_{n,t} + \epsilon_{n,t}$$

where, for each individual, $$\epsilon_{n,t}$$ is normally distributed across the multiple $$t$$ years following some correlation matrix $$\boldsymbol{\Sigma}$$. Stated clearly:

$$\boldsymbol{\epsilon}_n = (\epsilon_{n,1},\epsilon_{n,2},...,\epsilon_{n,T}) \sim MultiVariateNormal(\boldsymbol{0},\boldsymbol{\Sigma})$$

where $$\boldsymbol{0}$$ is a $$(T \times 1)$$ vector of zeros and $$\boldsymbol{\Sigma}$$ is a $$(T \times T)$$ correlation matrix.

When you assume the error term is distributed this way, you can finally add time-invariant characteristics to the model and it will still be estimable using likelihood maximization. Furthermore, the correlation terms within $$\boldsymbol{\Sigma}$$ are also estimable.

I hope this clears up a bit of the confusion around modeling panel data.

• "you can finally add time-invariant characteristics to the model and it will still be estimable using likelihood maximization. " this bit it not totally clear to me – Trajan May 8 '20 at 7:02
• and what the normal situation be (thats not panel data)? – Trajan May 8 '20 at 7:02
• What you are calling "the normal situation" (i.e., a case without panel data) is what is usually called "cross sectional data". Here, we just assume that income follows that first equation I wrote and that the error term is independently and identically distributed (iid) across all observations. In clearer terms, it's a case where I only have one observation per individual, not multiple observations per individual. In more concrete terms, a cross-sectional dataset would contain a snapshot of a bunch of people's information at one specific point in time. – Felipe D. May 12 '20 at 21:06
• As for the time-invariant part: some characteristics can change over time, such as an individual's age, weight, education level, etc. Other, however, cannot: race, eye color, height (at least after a certain age). When using panel data, the "classic" panel data approach (i.e., not using correlation matrices) makes it impossible to estimate the effects of these time-invariant variables. However, if you are using panel data with the correlation matrix approach, you can estimate the effect of time-invariant variables such as race. – Felipe D. May 12 '20 at 22:24
• If you have panel data but want to use a non-panel approach (i.e., purely cross-sectional data), you can also estimate the effect of these time-invariant effects. However, the estimates of this cross-sectional approach on panel data will likely be biased because there will be some sort of correlation in the error terms of some of the observations. – Felipe D. May 12 '20 at 22:30