10
$\begingroup$

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.

$\endgroup$

4 Answers 4

9
$\begingroup$

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.

$\endgroup$
3
$\begingroup$

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

$\endgroup$
2
$\begingroup$

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)
$\endgroup$
1
  • $\begingroup$ Sorry I don't understand your third recommendation. Why would you impute and then restore all NA? $\endgroup$ May 11, 2023 at 2:24
1
$\begingroup$

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

$\endgroup$
2
  • $\begingroup$ 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$? $\endgroup$
    – Stijn
    Jun 19, 2014 at 10:58
  • $\begingroup$ 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). $\endgroup$
    – F. Tusell
    Jun 19, 2014 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.