# Padding a matrix - effect on statistical analyses

I have the time-series data for a lot of stocks from their specific groups (market indices), and I would like to perform some quantitative tests on them as a group. Let's say for example I have 30 stocks over a period of 10 years with daily information. It is stored as a cell (in Matlab) so basically a matrix with 30 columns and 2520 (10 x 252 trading days in a year) rows. Lets say I want to find the correlation matrix, i.e. the correlation between each pair of stocks. To do this you needs a regular (rectangular) matrix - but my problem is that, say 3 of the stocks appeared only 8, 6 and 5 years ago, so their columns are 2, 4 and 5 years shorter than the others, respectively.

I have two options to get my rectangular matrix

1. chop of all data going further back that the oldest 'start-date' of a stock, which means losing 5 years of data in my example - not really an option.
2. fill out, 'pad', the shorter columns to make them the same length as the longer stocks.

I have already removed one or two stocks as they are really young, and now want to pad the few remaining stocks that have shorter time series.

My question is: to what extent will my results be affected/skewed/biased if I pad those columns and run the analyses (correlation etc.).

Would the errors be negligible? Can I minimise them with my choice of what I pad them with? I have considered using 'NaN' in Matlab, as it functions neutrally in many other analyses, but here it would throw an error. My next best guesses would be to pad with zero, or with the mean value of that column (i.e. the mean stock price over the time series).

Any other ideas, or is padding a complete no-no?

The information about correlation of the shorter series with the longer ones is in the information you have. How do you plan to 'pad' the series in such a way that will add to the available information about that particular correlation?

You might be able to use some form of imputation, but if that helped it would tend to imply some structure between the variables that probably should be directly in your model for the dependence structure.

Of course, you may well want to be able to use longer series to estimate the correlation between series that have more data*. The problem there is keeping a matrix positive definite; you can take approaches like estimating SVDs or Choleski decompositions of correlations, or simply find the nearest (in some sense) psd matrix to the pairwise-estimated one.

*(though even then, expecting the correlation to be constant over long periods would rarely make sense, in which case the distant past should probably get less weight in any case).

Some thoughts - which I'm only semi-confident about:

Padding seems likely to lead to a self-fulfilling analysis or distort the distribution. I've not thought about this in time series context but it sounds similar to 'mean imputation' in longitudinal/survey stats e.g..

Would another option be to estimate the cross-covariances of each time series separately using the greatest length available for each pair? Then put these together in a matrix. I am sure this would make calculations about standard errors etc very difficult but would use more of the data without manipulation.

• That is a good idea, thans for the insight. I Think it would then only be slightly strange to try comparing covariance values and other results (I will do Principal Component Analysis) that refer to differing time periods Mar 15, 2014 at 14:46