I am doing a univariate time series analysis on regional sea-surface temperatures which has missing data, and I am thinking about using the R package, 'imputeTS.' My model is simple, it has MA errors and a term linear in time. I would like to impute the missing data, but I am not sure which package method to use. Also, I am not sure how the error from the imputation would affect the SE of the slope. Could someone advise me on which method to use, and how to incorporate the imputation error on the slope? I would greatly appreciate any help.
Generally (without knowing the data itself) I always recommend na.kalman from the imputeTS package.
For using this method the time series should not be too short. (something like 12 values over all does not make too much sense here)
na.kalman is also very good if there is seasonality in the dataset. (From sea-surface temperatures I would expect this)
Another good method if there is seasonality in the dataset is na.seadec.
If you do not choose a completely inadequate imputation algorithm for your dataset (like e.g. mean) this should not affect the SE of the slope too much. There is no extrapolation done. The imputed values should fit to the statistical characteristics of the rest of the data.
But also keep in mind: by doing imputation there is always a risk of introducing error. It is also an option to go on without imputation if you do not necessarily need it. There are for example also established methods to model a time series with missing values (e.g. see Jones, R. H. (1980) Maximum likelihood fitting of ARMA models to time series with missing observations).
In the following a little description, what both mentioned algorithms are doing:
Uses Kalman Smoothing on a State Space Model for imputation.
This follows the following steps:
- Get/fit a State Space Model
- Estimate the missing values by kalman smoothing.
The State Space Model in step 1 can be a structural time series model obtained by StructTS or the space representation of a ARMA model obtained by auto.arima. A good follow up read is the following:
Harvey, Andrew C. Forecasting, structural time series models and the Kalman filter. Cambridge university press, 1990
Seasonally Decomposed Missing Value Imputation
Inlcludes the following steps
- Removes the seasonal component from the time series
- Performs imputation on the deseasonalized series with another algorithm (with standard parameters this is linear interpolation)
- Add back the seasonal component, which was removed in step 1.
Missing Value Imputation by Interpolation
Uses either linear, spline or stineman interpolation to replace missing values. Linear interpolation is the default parameter setting. The function internally uses approx for linear, spline for spline or stinterp (from package stinepack).