# SMEP: Panel Data I - Repeated Measures

First step in panel data are models that only look at a correlation within an individual or group but without correlation across group. These models are relatively simple since we have a block structure of correlation. In econometrics an example of this are panel data models with one error component, panel data with autoregressive within group correlation. In statistics these models are often under the heading of repeated measures or growth models. (Although I'm not sure yet what defines or distinguishes the latter.) A related approach is repeated measures ANOVA, which "suffers" however from strong statistical assumptions on the underlying data.

The extension to multiple error components, or to mixed effects models with several random effects, for example both time and individual or cross-sectional and intertemporal correlation, is computationally more difficult since we need to combine several correlation structures for the (nobs, nobs) correlation matrix of observations.

## Assumptions

• A1a : random components are uncorrelated with regressors, or stronger regressors are strictly exogenous.
• A1b : random components are correlated with regressors, implied for example in some dynamic models.
• A2 : correlation structure within group, AR, unstructured, random intercept, random slopes
• A3 : functional form
• A4 : distribution of error or of endogenous variable, gaussian, poisson, ...

## Approaches

• robust standard errors
• FGLS : feasible generalized least squares, two-step or iterative
• MLE : maximum likelihood, closed form only in few cases,
• semiparametric : conditional methods, GMM, GEE (?)
• REML : restricted maximum likelihood, (Still not much of an idea about this. What's the fire and what's the smoke.)
• others: JIVE ?

## Other Packages

• Stata : mostly GLS
• xtar
• xtgls
• xtgee
• xtbond, ....
• R : no "traditional" FGLS
• plm
• lm with options (?)

## Tools

• group and time handling
• likelihood function for gaussian model
• linear model: generate and estimate correlation structure, AR(p) from tsa (?); computational: avoid (nobs,nobs) operations and long loops
• numerical integration outside of gaussian-linear case

## Status

• robust covariance matrices : DONE (mostly) needs to be attached to RegressionResults
• OneWayMixed : I cleaned up the old version and it seems to work. I haven't found an equivalent in another package to test against. missing result statistics, and not clear whether all details are correct
• ShortPanel : looks ok in examples; so far only unrestricted within correlation; no test case yet; breaks if number of individuals is too small (at least if N<T)
• AR1Panel : added Prais-Winston for 1st observation identical results to Stata for fixed autocorrelation coefficient, estimate of autocorrelation coefficient differs from Stata, Stata has 6 methods to calculate rho, I'm doing something different. my results are mostly close to the range of results in Stata with different options (Grunfeld example).
• panelmod : (Skipper's original version) broken because recent pandas doesn't have LongPanel
• conditional methods: remove mean or transform for random intercept where is it?

• collect tools, especially correlation handling and group
• missing covariance structures, e.g. equal correlation
• merge AR1Panel with ShortPanel
• FGLS versus MLE for simple linear model ?
• computational shortcuts for balanced panels
• ...
• support for fixed effects models based on demeaning (missing ddof), computationally more efficient for large number of groups/individuals than dummy.
• ...
• GMM