# Is it good practice to standardize your data in a regression with panel/longitudinal data?

In general, I standardize my independent variables in regressions, in order to properly compare the coefficients (this way they have the same units: standard deviations). However, with panel/longitudinal data, I'm not sure how I should standardize my data, especially if I estimate a hierarchical model.

To see why it can be a potential problem, assume you have $i = 1, \ldots, n$ individuals measured along $t=1,\ldots, T$ periods and you measured a dependent variable, $y_{i,t}$ and one independent variable $x_{i,t}$. If you run a complete pooling regression, then it's ok to standardize your data in this way: $x.z = (x- \text{mean}(x))/\text{sd}(x)$, since it will not change t-statistic. On the other hand, if you fit an unpooled regression, i.e., one regression for each individual, then you should standardize your data by individual only, not the whole dataset (in R code):

for (i in 1:n) {
for ( t in 1:T) x.z[i] =  (x[i,t] - mean(x[i,]))/sd(x[i,])
}

However, if you fit a simple hierarchical model with a varying intercept by individuals, then you are using a shrinkage estimator, i.e, you are estimating a model between pooled and unpooled regression. How should I standardize my data? Using the whole data like a pooled regression? Using only individuals, like in the unpooled case?

I can't see that standardization is a good idea in ordinary regression or with a longitudinal model. It makes predictions harder to obtain and doesn't solve a problem that needs solving, usually. And what if you have $x$ and $x^2$ in the model. How do you standardize $x^2$? What if you have a continuous variable and a binary variable in the model? How do you standardize the binary variable? Certainly not by its standard deviation, which would cause low prevalence variables to have greater importance.

In general it's best to interpret model effects on the original scale of $x$.

• @Frank Harrell - good points about the problems associated with the conditions you outline but if one has all continuous variables with different scales then isn't standardization the only way to compare slopes? – DQdlM May 7 '11 at 17:07
• @Frank, I suppose it depends on what type of models you are running, but standardization of predictor variables is often useful. Centering them means that the intercept becomes interpretable as the mean predicted outcome and the relative importance of different predictors becomes more obvious. I usually leave binary predictors alone, but sometimes other scaling options are worth considering. Finally, in some cases having predictors with wildly different standard deviations can lead to computational/convergence problems. – Michael Bishop May 7 '11 at 19:01
• I'm not clear on how such standardization adds clarity rather than subtracts from it. Also, the mean is not the obvious choice for centering (median? mode? 43rd percentile? choice of dispersion measure is even more problematic) Relative importance can be judged in many ways, e.g., partial $R^2$, partial $\chi^2$, inter-quartile-range covariate effects, ... Also I have not found standardization to be helpful computationally when using modern matrix math routines such as the ones R uses under the hood. Kenny note that standardization is not the way to compare slopes. – Frank Harrell May 8 '11 at 14:33
• If you have binary variables, don't standardize them, only continuous one. See this article by Gelman (<stat.columbia.edu/~gelman/research/published/standardizing7.pdf>, suggesting dividing variables by two standard deviations. In any case, it helps to achive convergence if you are fitting a Bayesian model. – Manoel Galdino May 8 '11 at 15:04
• And I don't see why it would be better to interpret effects on the original scale. The effect of GDP on a logistic regresssion is hard to interpret looking only to coefficients, because GDP is much bigger than probability scale. Interactions are better understood with standardized coefficients or centered variables. Finally, if you have $x$ and $x^{2}$, in this case don't standardize. – Manoel Galdino May 8 '11 at 15:17

There is an alternative to standardization to bring variables measured with different scales to the same metric. It's called Proportion of Maximum Scaling (POMS), and it dies not mess with the multivariate distributions as z-transformation tends to do.

Todd Little explicitly recommends POMS over z-standardization in his book on longitudinal structural equation modeling. Z-transformation comes with additional problems when dealing with longitudinal data, see here: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4569815/