# Imputing missing observation in multivariate time series

Suppose I have a dataframe consisting of six time series. In this dataframe, some observations are missing, meaning at some timepoints all time series contain a NA-value. In R, one possible imputation package that can be used to impute time series data is Amelia. However, this package does not work for observations that are completely missing. Are there other ways to impute my data? For what it's worth, the amount of missing observations is less than 20% of all observations.

A good reference to solve your problem is the book "Time Series Analysis and Its Applications: With R Examples" by Robert H. Shumway and David S. Stoffer. A chapter is dedicated to the imputation of missing observations in multiple time-series analysis. Applications with code in R are also provided.

There is otherwise the package mtsdi for multivariate time series, it seems to offer an EM algorithm taking into account time auto-correlation and within variables correlation.

This package seems promising, although there appear to be a few implementation problems, I ran into one and there is another one reported here: https://stackoverflow.com/questions/29472532/arima-method-in-mtsdi

Using an state-space model is an alternative. You might want to check packages such as dlm, KFAS, or others.

• Thanks for your reply. So I would use a dynamic state space model to estimate the missing observation at time point $T$ using the observations on timepoints $1, \ldots, T-1$? – Stijn Jun 19 '14 at 10:58
• Well, it depends. If you are making a retrospective study, you might prefer to impute using all available information, i.e. observations at time points $1,\ldots, T$ (smoothed values as opposed to predicted values in state-space parlance). – F. Tusell Jun 19 '14 at 14:23

That most imputation packages don't work, has to do with their underlying algorithms. Imputation is done by employing inter-attribute correlations to estimate the missing values.

An easy understandable example:

You have attributes A,B,C,D. In row 20 attribute D is missing. From the past data the algorithm knows, when A is value x1 and B is value x2 and C is value x3 then the value of D is most likly x4. If now all four attributes are missing, the algorithm can not work. What algorithms being able to deal with this need to do is to consider information of other rows, to solve this problem.

The concrete problem could be fixed with one of this approaches:

• Use Amelia options: lag, leads, polytime (if you do not use these options it is doing nothing time series specific)
• Impute each column seperatly with imputeTS package (that is a package explicitly for time series imputation - but does not support multivariate datasets)
• Use imputeTS to impute each column, but then restore all NAs (except the rows where all values are missing), then use an imputation package like Amelia to impute the rest (better than option 2 if you think the inter-attribute correlations are stronger than the inter-time correlation)